Transfer file form one server to another using ftp

Code for transfer file from your one server to another ftp server

Transfer file into ftp server

Code for transfer file from your one server to another ftp server

Transfer your file from one server to another sever using ftp

Here is the code for file transfer

Public Sub WriteFileToFtp()

Dim myFtpWebRequest As FtpWebRequest
Dim myFtpWebResponse As FtpWebResponse
Dim myStreamWriter As StreamWriter

Dim strFile As String = "FileName With Location"

myFtpWebRequest = WebRequest.Create("ftp://(Your Ftp IP address)//FileName")
myFtpWebRequest.Credentials = New NetworkCredential("UserName", "Password")
myFtpWebRequest.Method = WebRequestMethods.Ftp.UploadFile
myFtpWebRequest.UseBinary = True

myStreamWriter = New StreamWriter(myFtpWebRequest.GetRequestStream())
myStreamWriter.Write(New StreamReader(strFile).ReadToEnd)
myFtpWebResponse = myFtpWebRequest.GetResponse()

End Sub

Related Articles

More articles: Trasnfer FTP file Transfer file FTP file hierarchy Get FTP directory


Author: Ajmal Abbasi27 Sep 2010 Member Level: Bronze   Points : 1

Excellent code. I was just in search of such a code, and surprisingly, code ran very correctly in my first attempt :) Thanks for sharing such a nice code snippet which saved my time and energy :)

Author: Pratap27 Sep 2010 Member Level: Gold   Points : 0

It is Helpful

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: