Reputation: 1258
I'm transferring a file using ftp in Delphi.
I am able to connect to the ftp account ok but when I try and upload a file the FtpOpenFile function returns nil instead of a handle the file to be uploaded.
hintfile := FtpOpenFile(hintconnect,PChar(tgtfn),GENERIC_WRITE,FTP_TRANSFER_TYPE_BINARY,0);
If I log into the ftp site using an ftp client application and exactly the same credentials I can upload the file without a problem.
Any suggestions appreciated.
Upvotes: 0
Views: 1512
Reputation: 26358
Try adding INTERNET_FLAG_PASSIVE to your Internetopen call, see also
Upvotes: 0
Reputation:
Try to get the last error, documentation says it all:
"Returns a handle if successful, or NULL otherwise. To retrieve a specific error message, call GetLastError."
http://msdn.microsoft.com/en-us/library/aa384166(VS.85).aspx
Upvotes: 1