Results 1 to 4 of 4

Thread: Upload/Download via FTP

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2007
    Posts
    32

    Upload/Download via FTP

    How can I upload text files using FTP server e.g. ftp://ftp.example.com (with username and password) in Microsoft Visual Basic 2005 express edition... ?

  2. #2
    New Member Xscapism's Avatar
    Join Date
    Aug 2010
    Posts
    9

    Re: Upload/Download via FTP

    You can use the UploadFile method present in the 'My.Computer.Network' class to upload and download files from FTP. Example usage of UploadFile:

    vb Code:
    1. My.Computer.Network.UploadFile(filenameToUpload, "ftp://ftp.example.com", "ftpUsername", "ftpPassword", True, 1000000)

    Just replace file name, credentials and ftp address to upload your file.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2007
    Posts
    32

    Re: Upload/Download via FTP

    Is there any error handling associated with this code (I don't wanna use MsgBox here). DownloadFile is a BackgroundWorker Control ... Label1 is a label control to show error.

    THIS CODE ISN"T WORKING AT ALL ... (InvalidOperationException error is displayed)

    vb Code:
    1. Private Sub DownloadFile_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles DownloadFile.DoWork
    2.  
    3. On Error GoTo ErrorOccExcep
    4. My.Computer.Network.DownloadFile("http://www.example.com/file.txt", "C:\file_temp.txt")
    5. ErrorOccExcep:
    6. Label1.Text = "Error occurred!"
    7.  
    8. End Sub

    Help please ...

  4. #4
    PowerPoster Radjesh Klauke's Avatar
    Join Date
    Dec 2005
    Location
    Sexbierum (Netherlands)
    Posts
    2,244

    Re: Upload/Download via FTP

    No need to shout, just search the forum.
    Example; http://www.vbforums.com/showthread.php?t=468649


    If you found my post helpful, please rate it.

    Codebank Submission: FireFox Browser (Gecko) in VB.NET, Load files, (sub)folders treeview with Windows icons

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