I want to upload files from particular location.
I got problem with GetRequestStream() function.
Here is the code:
Error message is:Code:Dim path() As String = Directory.GetFiles("C:\files\") 'I tried and with("C:/files/") For Each files As String In path Dim ftprequest = DirectCast(WebRequest.Create("ftp://" & FTPHost & "/" & files), FtpWebRequest) ftprequest.EnableSsl = True ftprequest.Credentials = New NetworkCredential(user, password) ftprequest.Method = WebRequestMethods.Ftp.UploadFile Dim file() As Byte = My.Computer.FileSystem.ReadAllBytes(files) Dim ftpstream As Stream = _ ftprequest.GetRequestStream() ftpstream.Write(file, 0, file.Length) ftpstream.Close() ftpstream.Dispose() 'My.Computer.Network.UploadFile(files, "ftp://" & FTPHost & "/" & files, user, password, False, 50000) Next
When I tried with My.Computer.Network.UploadFile(...)Code:The remote server returned an error: (500) Syntax error, command unrecognized.
I got this error:
Code:The remote server returned an error: (550) File unavailable (e.g., file not found, no access).




Reply With Quote