|
-
Aug 13th, 2010, 07:47 AM
#1
Thread Starter
Member
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... ?
-
Aug 13th, 2010, 08:10 AM
#2
New Member
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:
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.
-
Aug 28th, 2010, 02:04 AM
#3
Thread Starter
Member
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:
Private Sub DownloadFile_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles DownloadFile.DoWork On Error GoTo ErrorOccExcep My.Computer.Network.DownloadFile("http://www.example.com/file.txt", "C:\file_temp.txt") ErrorOccExcep: Label1.Text = "Error occurred!" End Sub
Help please ...
-
Aug 28th, 2010, 07:02 AM
#4
Re: Upload/Download via FTP
No need to shout, just search the forum.
Example; http://www.vbforums.com/showthread.php?t=468649
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|