I have created a small windows forms application to upload the file to one of our client\'s ftp site. But the problem that I\'m having is that when I run this application on
I too had this problem recently. What I found is that when I use ftpUploadFile the routine is trying to put the file in the root ftp folder. Normal command line ftp worked fine. However issuing a pwd command from the command line ftp revealed that this particular server was setting a different current directory upon login. Altering my ftpUploadFile to include this folder resolved the issue.
I found the solution. The problem is the Current Working Directory of the ftp user. If you type a url like ftp:///path/test.txt it is used as a relative path ro the working directory. For example CWD is /test then the used path is /test/path/test.txt. If you want to use an absolute path, you have to type the url like ftp:////path/test.txt. Then the file is uploaded in the folder /path/test.txt, without exception.
In my case, there was a root folder referenced in my ftp address that was missing. After to create the folder the problem was solved.
ftp://xxx.xxx.xx.xx:21//rootfolder/
When i had the same issue i tried everything above and after a day later i realize that the path which i created for uri having a white space in between "/" and the folder name
string uri="192.168.1.101/ Sync/Image.jpg";
the above string should be
string uri="192.168.1.101/Sync/Image.jpg";
this small mistake also throws the same error and it's a valid error because this is not valid path for our file if it contains any white spaces between "/" and folder/file name
I was also having the same issue. After monitoring the traffic with WireShark I understood the problem
I had set up a new FTP site on my local IIS FTP server named 'testftp' The 'testftp' site was pointing to a folder named d:\ftp on my computer's hard disk I was getting the '550' error whenever i tried to execute the line in bold in C# code below ftpHostURL="ftp://127.0.0.1/testftp/test.htm"; request = (FtpWebRequest)WebRequest.Create(ftpHostURL); request.Proxy = new WebProxy(); //-----Proxy bypassing(The requested FTP command is not supported when using HTTP proxy)
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Credentials = new NetworkCredential(ftpUserName, ftpPassword);
// uploadFilePath = "d://test//tt.txt";
using (var requestStream = request.GetRequestStream())
{
using (var input = File.OpenRead(uploadFilePath))
{
input.CopyTo(requestStream);
}
}
I tried a lot of solutions mentioned in various websites but nothing helped. Then I came across a site that suggested to use WireShark to monitor the traffic.
On monitoring the traffic using the RawCap Utility I saw that the application was trying to execute the code below
STOR testftp/test.htm
Then I understood the problem. IIS was expecting a folder named 'testftp' to be there under the ftp root folder which was not there. I was considering 'testftp' as the name of the virtual folder created in IIS where as IIS understood it as a folder under the FTP root
Creating a folder named 'testftp' under the FTP root folder solved my issue.
Hope this is helpful to someone
Regards Mathew
I met the same problem, and this is what I did:
I can use four pictures to show the rights to be set: