标题:ftp上传文件报:文件不可用! ??
取消只看楼主
xman81
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-4-1
结帖率:0
已结贴  问题点数:20 回复次数:2 
ftp上传文件报:文件不可用! ??
问题如题:
在winfrom中建此项目;
代码:
FileInfo fileInf = new FileInfo("h:\\123.txt");
            string uri = "ftp://54.25.110.112/123123/web" + fileInf.Name;
            FtpWebRequest reqFTP;
            reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uri));
            reqFTP.Credentials = new NetworkCredential("123123","123123");
            reqFTP.KeepAlive = false;
            reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
            reqFTP.UseBinary = true;
            reqFTP.ContentLength = fileInf.Length;
            int buffLength = 5120;
            byte[] buff = new byte[buffLength];
            int contentLen;
            FileStream fs = fileInf.OpenRead();
            try
            {
              Stream strm =  reqFTP.GetRequestStream();
                contentLen = fs.Read(buff, 0, buffLength);
              while (contentLen != 0)
                {
                  
                    strm.Write(buff, 0, contentLen);

                    contentLen = fs.Read(buff, 0, buffLength);
                }
                strm.Close();
                fs.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Upload Error");
            }

报错: 远程服务器返回错误(550)文件不可用(例如未找到文件/无法仿问)
请大家帮忙解决,谢谢![
搜索更多相关主题的帖子: 文件 ftp 
2010-04-01 11:30
xman81
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-4-1
得分:0 
这句话什么意思啊?
2010-04-01 13:59
xman81
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-4-1
得分:0 
加上了还是不行哦!!
2010-04-01 14:41



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-301270-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021719 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved