C
chris
Hi,
I am trying to upload files on FTP and used the code below:
Dim request As FtpWebRequest
request =
WebRequest.Create("ftp://ftp...../test.txt")
request.Method = WebRequestMethods.Ftp.UploadFile
request.Credentials = New
NetworkCredential(ftp_site_user_name, ftp_site_password)
Dim sourceStream As New
StreamReader("C:\Documents and Settings\.......\text.txt")
Dim filecontents() As Byte =
Encoding.UTF8.GetBytes(sourceStream.ReadToEnd())
sourceStream.Close()
request.ContentLength = filecontents.Length
Dim requestStream As Stream =
request.GetRequestStream()
requestStream.Write(filecontents, 0,
filecontents.Length)
requestStream.Close()
When I define to use proxy (in Interent options/connections/LAN
settings) I receive an error "The requested FTP command is not
supported when using HTTP proxy". When I define NOT to use proxy, the
file is transfered on FTP.
1. Is there a way for defining to bypass the proxy for this ftp
connection ?
2. Can I create subdirectories on FTP from code ?
3. StreamReader reads TXT files. How can I read ZIP files for uploading
on FTP ?
Thanks a lot.
I am trying to upload files on FTP and used the code below:
Dim request As FtpWebRequest
request =
WebRequest.Create("ftp://ftp...../test.txt")
request.Method = WebRequestMethods.Ftp.UploadFile
request.Credentials = New
NetworkCredential(ftp_site_user_name, ftp_site_password)
Dim sourceStream As New
StreamReader("C:\Documents and Settings\.......\text.txt")
Dim filecontents() As Byte =
Encoding.UTF8.GetBytes(sourceStream.ReadToEnd())
sourceStream.Close()
request.ContentLength = filecontents.Length
Dim requestStream As Stream =
request.GetRequestStream()
requestStream.Write(filecontents, 0,
filecontents.Length)
requestStream.Close()
When I define to use proxy (in Interent options/connections/LAN
settings) I receive an error "The requested FTP command is not
supported when using HTTP proxy". When I define NOT to use proxy, the
file is transfered on FTP.
1. Is there a way for defining to bypass the proxy for this ftp
connection ?
2. Can I create subdirectories on FTP from code ?
3. StreamReader reads TXT files. How can I read ZIP files for uploading
on FTP ?
Thanks a lot.