Click here to Skip to main content
15,943,623 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I have a ftp uploading source code like this
VB
Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.DriveHQ.com/Protocol.csv"), System.Net.FtpWebRequest)
  request.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
  request.Method = System.Net.WebRequestMethods.Ftp.UploadFile

  Dim file() As Byte = System.IO.File.ReadAllBytes(TextBox3.Text)

  Dim strz As System.IO.Stream = request.GetRequestStream()
  strz.Write(file, 0, file.Length)
  strz.Close()
  strz.Dispose()

But this code let me to upload the specific file.So, how should i changed to make it able to upload any others file without specify it? Then, can someone gave me a guide on how to create a ftp download system to download the any file on online ftp server. I have try many code but still having error don't know how to make it.
Posted

1 solution

The class System.Net.FtpWebRequest does it all, see http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx[^].

"to upload without specify it" simply makes no sense. How do you imagine that? FTP resembles a simple file system, that's it. You can list the file structure, upload and download using the file names, that's all.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900