|
-
Sep 7th, 2008, 07:14 AM
#1
Thread Starter
Hyperactive Member
[02/03] FTP a file How to ?
Hi,
How to upload a file using FTP ? in 2003
can someone help me on this.
thanks in advance
-
Sep 7th, 2008, 07:19 AM
#2
Re: [02/03] FTP a file How to ?
WebClient.UploadFile for simple scenarios, FtpWebRequest for more complex scenarios.
-
Sep 7th, 2008, 07:28 AM
#3
Thread Starter
Hyperactive Member
Re: [02/03] FTP a file How to ?
-
Sep 7th, 2008, 07:45 AM
#4
Thread Starter
Hyperactive Member
Re: [02/03] FTP a file How to ?
ok. Here is my code
vb 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 Module
am getting an error saying
Code:
An exception occurred during a WebClient request.
-
Sep 7th, 2008, 07:51 AM
#5
Re: [02/03] FTP a file How to ?
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.
-
Sep 7th, 2008, 10:37 AM
#6
Frenzied Member
Re: [02/03] FTP a file How to ?
I write in 2005/2008 so im not sure if 02/03 has this.
Can't you use:
-
Sep 7th, 2008, 11:30 AM
#7
Re: [02/03] FTP a file How to ?
 Originally Posted by noahssite
I write in 2005/2008 so im not sure if 02/03 has this.
Can't you use:
Unfortunately the My namespace was introduced in 2005.
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
|