FtpOpenFile 上传时返回 nil 而不是文件句柄
我正在 Delphi 中使用 ftp 传输文件。
我可以正常连接到 ftp 帐户,但是当我尝试上传文件时 FtpOpenFile函数返回nil而不是要上传的文件的句柄。
hintfile := FtpOpenFile(hintconnect,PChar(tgtfn),GENERIC_WRITE,FTP_TRANSFER_TYPE_BINARY,0);
如果我使用 ftp 客户端应用程序和完全相同的凭据登录 ftp 站点,我可以毫无问题地上传文件。
任何建议表示赞赏。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试获取最后一个错误,文档说明了一切:
http://msdn. microsoft.com/en-us/library/aa384166(VS.85).aspx
Try to get the last error, documentation says it all:
http://msdn.microsoft.com/en-us/library/aa384166(VS.85).aspx
尝试将 INTERNET_FLAG_PASSIVE 添加到您的 Internetopen 调用中,另请参阅
http://etutorials.org/Programming/Pocket+pc+network+programming/Chapter+2.+WinInet/File+Transfer+Protocol+FTP/
Try adding INTERNET_FLAG_PASSIVE to your Internetopen call, see also
http://etutorials.org/Programming/Pocket+pc+network+programming/Chapter+2.+WinInet/File+Transfer+Protocol+FTP/