FtpOpenFile 上传时返回 nil 而不是文件句柄

发布于 2024-08-17 19:12:48 字数 293 浏览 4 评论 0原文

我正在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情深如许 2024-08-24 19:12:48

尝试获取最后一个错误,文档说明了一切:

“如果成功则返回句柄,或者
否则为 NULL。检索特定的
错误消息,调用 GetLastError。”

http://msdn. microsoft.com/en-us/library/aa384166(VS.85).aspx

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

望喜 2024-08-24 19:12:48

尝试将 INTERNET_FLAG_PASSIVE 添加到您的 Internetopen 调用中,另请参阅

http://etutorials.org/Programming/Pocket+pc+network+programming/Chapter+2.+WinInet/File+Transfer+Protocol+FTP/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文