FtpWebRequest异步上传

编程入门 行业动态 更新时间:2024-10-26 08:30:01
本文介绍了FtpWebRequest异步上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用MSDN中列出的代码将文件上传到FTP服务器 。 msdn.microsoft/en-us/library/system.ftpwebrequest .aspx 我提供服务器凭据,设置模式和超时。并且在回调(EndGetStreamCallback)中,它崩溃在 requestStream = state.Request.EndGetRequestStream(ar); 与以下异常 WebException:远程服务器返回错误:( 550)文件不可用(例如,找不到文件,没有访问权限)。 我查看了我的应用程序和站点的FTP流量,并观察到连接成功但是<它有请求:OPT utf8 on响应:550权限被拒绝。和PWD(打印工作目录)是"/ download /"我的路径是"ftp:// ftp.xxx/upload/filename.txt"然后尝试用命令"CWD / download / upload /"更改目录,因为没有这样的目录存在远程服务器重新上传上面提到的错误例外。 请告知。 谢谢你的SM

I am uploading file to FTP server asynchronously using the code listed in MSDN. msdn.microsoft/en-us/library/system.ftpwebrequest.aspx I give the server credentials, set  the mode and timeout. And in the callback (EndGetStreamCallback) it crashes at requestStream = state.Request.EndGetRequestStream(ar); with following exception WebException: The remote server returned an error: (550) File unavailable (e.g., file not found, no access). I looked at the FTP traffic b/w my application and site and observed that the connection was a success but it had Request: OPT utf8 on Response: 550 Permission denied. and the PWD (Print Working Directory) was "/download/" and my since i gave a path "ftp:// ftp.xxx/upload/filename.txt" it then tries to change the directory with the command "CWD /download/upload/", since no such directory exists remote sever reutrned the error mentioned in the above exeption. Please advise. Thanks SM

推荐答案

你不能确定在尝试将文件上传到该目录之前,目标目录是否存在? Shouldnt you make sure that the destination directory exists first, before trying to upload a file into that directory?

更多推荐

FtpWebRequest异步上传

本文发布于:2023-11-09 15:28:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572732.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:上传   FtpWebRequest

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!