 |
|
 |
Hi,
I found your code very useful for downloading of files. I need some more info on this. My requirement is that I need to get the list of all available files in a particular FTP server and then download the files one by one. My problem now is when given an FTP server path, how do I just get the list of names of files available on that server?
Can you please help me to do this?
Thanks
|
|
|
|
 |
|
 |
hi,
it's nice to see such a simple code here. Yet i would like to put the code into function for embedded visual C++ 4. Any idea on what to do?
|
|
|
|
 |
|
 |
Hello,
I am puzzled on as to why the Expand function is not working in my
program. What I have is a function that calls generic Expand() function of
CTreeCtrl. Here, my_tree member variable came from:
cn_tree ctr_tree; //from class cn_tree : public CTreeCtrl
cn_tree* my_tree;
my_tree = &ctr_tree; //because ctr_tree handles controls
then I populate my_tree->PopulateTree(connect, some_string);
and here is the problem:
Onclick OnTree() is invoked
void cedlg1::OnTree()
{
HTREEITEM hItem_s = my_tree->GetSelectedItem();
if (hItem_s != NULL)
{
//** Expand not working **
my_tree->Expand(hItem_s, TVE_EXPAND);
}
}
Please note, the hItem_s returns a non-NULL value and a right directory name
as I used a MessageBox("The item is: " + my_tree->GetItemText(hItem_s)); to
check. Since Expand() is a generic function and hItem_s appears to return the right directory name, it should work as per MSDN definition. Does anybody know why it is not working? Thank you,
Victor.
|
|
|
|
 |
|
 |
well, can you please give the code to test this function?
i have tried to run it on VC++ several times but failed. and i am about to go crazy
i will be very pleased if you respond.
dd
|
|
|
|
 |
|
 |
Hi!
I'm using your code in my application.
It works fine when option in Internet explorer browser "Work offline"
(File->Work offline) is unchecked, but when I check that option and when I try to download file from ftp I get this message:
"The computer is disconnected from the network"
How can I solve this problem.
Regards.
|
|
|
|
 |
|
 |
What could possible be wrong when CFtpConnection::GetFile(…) returns 5 (Access is denied). I know the file exists because I’ve just successfully made a CFtpConnection::PutFile(…). I’m using the same CFtpConnection object.
How could I have right to write to my ftp but no right to read.
Any tips are helpful…
_____________________________
...and justice for all
APe
|
|
|
|
 |
|
 |
Maybe you don't have enough permission to do the operations which you'd intended to do.
|
|
|
|
 |
|
 |
Hi,
I was wondering if you tested it with VC6. I tried to download a file that has blank spaces in its name and it doesnt work, because it cant find the file. It works fine in VC7. I cant figure out whats going on. I would appreciate your help.
Thank you,
John
|
|
|
|
 |
|
 |
i was trying to integrate this little code into a dll
but it chashed on an assertion fail..
to be more precise "afxwin1.inl line 31".
why happends this?
|
|
|
|
 |
|
 |
I have the same problem...
Franz
|
|
|
|
 |
|
 |
you need to give the application a name:
CInternetSession mysession(_T("MyProgram/1.0"));
|
|
|
|
 |
|
 |
Thanks~~~~~```
I have been seeking the method to fix the problem!
|
|
|
|
 |
|
 |
I am just a newbie, so excuse my lack of knowledge.
You are saying just to integrate the function in my application, but how to do that: does it have to be in the cpp or the header file? Do we need to include the afxinet.h file? Is it enough just to copy the code in the application or I need to modify something else?
WHere I can find tutorial of the basics of building an application in C++ 6?
|
|
|
|
 |
 | Useful  |  | Anonymous | 16:39 15 Jul '02 |
|
 |
Hi, This is a rather useful function for doing FTP put n get. What about tftp put and get files? Is it supported too?
|
|
|
|
 |
|
 |
How about resuming?
|
|
|
|
 |
|
 |
Agreed - if this supported resuming, it'd be much more useful. Anyone up to the task of adding that in?
|
|
|
|
 |
|
 |
As i know, MFC class CFtpSession do not support download resuming.
You need work directly with server. You need work throw sockets and send commands like 'list' 'rest' 'retr' directly.
May be i'm wrong and somebody make it (resuming) with easy?
|
|
|
|
 |
|
 |
WinInet have FtpCommand. Meyby use it to send commands?
|
|
|
|
 |
|
 |
Hi. You say this builds with VC6, however with VC 4 I don't have the 'afxinet.h' file, which gives the declerations for CInternetSession, CFtpConnection, and CFtpFileFind. Any idea where I can pick up the afxinet.h and associated .cpp files?
please reply to jrober@homeonthethrone.com
thanks, jeff
|
|
|
|
 |
|
 |
The problem is that class is in VC 4.2 in Advance.
If you are working with vc4 You need to Use the Apis....
like ::InterneOpen(), ::InternetConnect(); ::FtpGetFile(); ::FtpFindFirstFile();
etc.
you need the Wininet.h header and the Wininet.lib for link
Good Luck!!!
Carlos Antollini.
|
|
|
|
 |
 | Upload  |  | Anonymous | 4:06 18 Jul '01 |
|
 |
How about Upload
|
|
|
|
 |
|
 |
you could tweak the above function to use PutFile(....) instead of GetFile, However you should know where on the server you're going to place your file, the SetCurrentDirectory(LPCSTR) member function of CFtpConnection class sets the directory on the ftp server, you 'll need this.
Check out the CFtpConnection and CInternetSession classes in MSDN.
I'll post an upload version of this funtion later this week (hopefully!).
|
|
|
|
 |
|
 |
Hi,
Great thanks to You!
Still I'm trying upload....
Br Jakke
|
|
|
|
 |
|
 |
CFtpConnection::PutFile
BOOL PutFile( LPCTSTR pstrLocalFile, LPCTSTR pstrRemoteFile, DWORD dwFlags = FTP_TRANSFER_TYPE_BINARY, DWORD dwContext = 1 );
Return Value
Nonzero if successful; otherwise 0. If the call fails, the Win32 functionGetLastError may be called to determine the cause of the error.
Look for MSDN for more help
|
|
|
|
 |
|
 |
Hi,
Just one thing - when you return error messages, I prefer just to use a boolean:
bool MyFn(...)
{
if ()
return false;
}
You could always use exceptions, or perhaps use the HRESULTs. Strings are bad for several reasons:
1. They take more memory up
2. They are slower
It's obvious you thought you could just put the string straight into a message box - this is a good idea apart from the fact that code that needs to work across multiple languages is stuffed . Also, string comparisons take a lot long than comparing a true/false value.
Hope that helps,
> Andrew.
|
|
|
|
 |