需要有关FTP上传和下载的帮助. [英] Need help on FTP upload and download.
本文介绍了需要有关FTP上传和下载的帮助.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个ftp上传这样的源代码
I have a ftp uploading source code like this
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()
但是此代码允许我上传特定文件,因此,我应该如何更改以使其能够在不指定文件的情况下上传其他文件呢?然后,有人可以给我提供有关如何创建ftp下载系统以下载在线ftp服务器上的任何文件的指南.我尝试了很多代码,但是仍然有错误,但不知道如何制作.
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.
推荐答案
类System.Net.FtpWebRequest
可以完成所有操作,请参见 http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx [^ ].
没有指定就上传"根本没有意义.您如何想象? FTP就像一个简单的文件系统.您可以列出文件结构,然后使用文件名进行上传和下载.
—SA
The classSystem.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
这篇关于需要有关FTP上传和下载的帮助.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文