Hi -
I am attempting to upload files to ftp via the .NET FtpWebRequest.
I can upload the file to the ftp via a stream method, but cannot figure out how to specify the "target file name" on the ftp.
This uploads the file, but with a binary filename like "0879tmp"
Any help on this would be much appreciated!!
I am attempting to upload files to ftp via the .NET FtpWebRequest.
I can upload the file to the ftp via a stream method, but cannot figure out how to specify the "target file name" on the ftp.
Code:
Dim Ftp As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create(Host), System.Net.FtpWebRequest)
Ftp.Credentials = New System.Net.NetworkCredential(User, Password)
Ftp.Method = System.Net.WebRequestMethods.Ftp.UploadFileWithUniqueName
Dim bFile() As Byte = System.IO.File.ReadAllBytes(FilePath)
Dim clsStream As System.IO.Stream = Ftp.GetRequestStream()
clsStream.Write(bFile, 0, bFile.Length)
Ftp.RenameTo.ToString(UPC)
clsStream.Close()
clsStream.Dispose()
This uploads the file, but with a binary filename like "0879tmp"
Any help on this would be much appreciated!!