FtpWebResponse.Method = Ftp.UploadFileWithUniqueName

I am writing a Winforms program to replace a cmd batch file that uploads a file to an ftp site and the folder on that site is d:\UploadedFiles. The site is ftp://uapkb100.central.com. I can upload to the ftp site by using the following create stmts but I cannot figure out a way to upload the file to the d:\UploadedFiles folder. The cmd file used the following lines in its ftp text file. How can I do the same thing in my .Net program That is write to the correct folder.

:--DOS Cmd file stmts-----

UserID

Password

lcd d:/UploadedFiles

put SANION13.txt

'----My VB.2005 statements--------

Dim uploadResponse As FtpWebResponse = Nothing

Dim uploadRequest As FtpWebRequest = Nothing

ftpFileName = "ftp://uapkb100.central.com/" & txtFileName.Text

uploadRequest = FtpWebRequest.Create(ftpFileName)

' --rest of stmts to write the file to ftp




Answer this question

FtpWebResponse.Method = Ftp.UploadFileWithUniqueName

  • Boulderdude

    Smth like ftpFileName = "ftp://uapkb100.central.com/UploadedFiles/" & txtFileName.Text
  • OneScrappyLady

    Yes, that is the technique we use but we wanted to change directories in the FTP in a manner similar to that used in character based ftp operations. I opened an incident with Microsoft and apparently there is no way to do a change directory in this class. Following is a quote from the case notes. "... the CWD command cannot be issued through FtpWebRequest. This is a known limitation of the FtpWebRequest Class. You can however have a finer control over the Ftp Commands by implementing your own Ftp Class as per this KB article: http://support.microsoft.com/default.aspx scid=kb;en-us;832679"

  • FtpWebResponse.Method = Ftp.UploadFileWithUniqueName