-1

I am currently using FTPwebRequest to move a local file over to a server. I am able to FTP to the root directory at ftp://ftp.xxxx.com. But, whenever I try to FTP the file to a folder within that directory like: ftp://ftp.xxxx.com/firstfolder nothing happens. I don't get any hard halts in the code and I also setup a FTPwebResponse stating that the transfer is complete.

string dest = "ftp://username:password@ftp.xxxx.com/firstfolder/" + fileName;

ftp = (FtpWebRequest)FtpWebRequest.Create(dest);

I have also tried using %2f to mimic the CD command.

Here are a few links I have been looking at with no luck: https://blogs.msdn.microsoft.com/mariya/2006/03/06/changing-to-the-root-directory-with-ftpwebrequest

https://social.msdn.microsoft.com/Forums/en-US/91e2bed0-9e5e-4503-9e66-d224086e43a8/change-directory-with-ftpwebrequest

https://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest(v=vs.110).aspx

Hunter Zolomon
  • 97
  • 1
  • 2
  • 9
  • `string dest = "ftp://username:password@ftp.xxxx.com/firstfolder/" + fileName;` – Gusman Jan 09 '18 at 18:22
  • Hey @Gusman it was what you had. I typed it out wrong. Still doesn't work formatted like that. – Hunter Zolomon Jan 09 '18 at 18:26
  • 1
    Possible duplicate of [Upload file to FTP using C#](https://stackoverflow.com/questions/15268760/upload-file-to-ftp-using-c-sharp) – Gusman Jan 09 '18 at 18:28
  • When you use FTP the file goes into a default startup folder depending on the login to the ftp site (or anonymous). I suspect the folder is going into a different folder than where you are looking. Try use an IE with url ftp://ftp.xxxx.com (yes include ftp instead of http) and see if you can locate the file. – jdweng Jan 09 '18 at 18:36
  • When I ftp to the root directory I can see it in a web browser. But when I use the /firstfolder/filename I don't see it in that directory. I even copy and pasted the path from my code to make sure it was correct. – Hunter Zolomon Jan 09 '18 at 18:46
  • Gusman I checked out the link you provided. It didn't provide me with a solution to my problem. I tried using Webclient as well, but I need to FTP not to root or startup folder. – Hunter Zolomon Jan 09 '18 at 18:47
  • So I tried viewing the directory in a different web browser and behold the file exists. With IE the file was not showing, but with google chrome the file did exist. Very weird, but I have answered my own question. – Hunter Zolomon Jan 09 '18 at 19:53

1 Answers1

0

In IE the file did not appear in the servers directory. I used google chrome and I was able to view the file successfully. It was uploaded the hole time.

Hunter Zolomon
  • 97
  • 1
  • 2
  • 9