Results 1 to 2 of 2

Thread: FTP Upload problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2008
    Posts
    149

    FTP Upload problem

    I want to upload files from particular location.
    I got problem with GetRequestStream() function.

    Here is the code:
    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
    Error message is:
    Code:
    The remote server returned an error: (500) Syntax error, command unrecognized.
    When I tried with My.Computer.Network.UploadFile(...)
    I got this error:
    Code:
    The remote server returned an error: (550) File unavailable (e.g., file not found, no access).

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Sep 2008
    Posts
    149

    Re: FTP Upload problem

    Bump!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width