Hi,
How to upload a file using FTP ? in 2003
can someone help me on this.
thanks in advance
Printable View
Hi,
How to upload a file using FTP ? in 2003
can someone help me on this.
thanks in advance
WebClient.UploadFile for simple scenarios, FtpWebRequest for more complex scenarios.
thanks will try now
ok. Here is my codeam getting an error sayingvb Code:
Imports System.net Module Module1 Sub Main() 'system.Net.WebClient.UploadFile( Dim uriString As String = "ftp://username:[email protected]/public_html/Temp/test.txt" ' Create a new WebClient instance. Dim myWebClient As New WebClient Dim fileName As String = "C:\Temp\test.txt" Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString) ' Upload the file to the URI. ' The 'UploadFile(uriString,fileName)' method implicitly uses HTTP POST method. Dim responseArray As Byte() = myWebClient.UploadFile(uriString, fileName) ' Decode and display the response. Console.WriteLine(ControlChars.Cr & "Response Received.The contents of the file uploaded are: " & _ ControlChars.Cr & "{0}", System.Text.Encoding.ASCII.GetString(responseArray)) End Sub End ModuleCode:An exception occurred during a WebClient request.
I'm not sure that you can include the credentials in the URL like that with a WebClient. The object has a Credentials property. Try setting that and then just using the plain URL.
I write in 2005/2008 so im not sure if 02/03 has this.
Can't you use:
vb.net Code:
My.Computer.Network
Unfortunately the My namespace was introduced in 2005.Quote:
Originally Posted by noahssite