回答
一些链接:
VB.NET:http://www.codeproject.com/KB/IP/FtpClient.aspx
C#:http://www.c-sharpcorner.com/uploadfile/neo_matrix/simpleftp01172007082222am/simpleftp.aspx
这不是免费的dll。文件。我需要示例访问直接Microsoft库 – 2010-03-15 20:06:27
该代码是公共领域,您应该能够从您的VB.NET应用程序访问类。你还需要什么? – 2010-03-15 20:17:53
我尝试从codeproject.com FTpclient.cs类,但是当我尝试从我的FTP下载文件它给了我错误文件不可用或没有访问,并且我认为它没有访问错误,我如何可以从ftp访问下载文件。 谢谢 – 2010-03-16 16:09:11
如果你想干脆直接重新上传文件,只需管下载流上载流:
Dim downloadRequest As FtpWebRequest =
WebRequest.Create("ftp://downloadftp.example.com/source/path/file.txt")
downloadRequest.Method = WebRequestMethods.Ftp.DownloadFile
downloadRequest.Credentials = New NetworkCredential("username1", "password1")
Dim uploadRequest As FtpWebRequest =
WebRequest.Create("ftp://uploadftp.example.com/target/path/file.txt")
uploadRequest.Method = WebRequestMethods.Ftp.UploadFile
uploadRequest.Credentials = New NetworkCredential("username2", "password2")
Using downloadResponse As FtpWebResponse = downloadRequest.GetResponse(),
sourceStream As Stream = downloadResponse.GetResponseStream(),
targetStream As Stream = uploadRequest.GetRequestStream()
sourceStream.CopyTo(targetStream)
End Using
如果你需要处理的内容s ^不知何故,或者如果您需要监测的进展,或两者兼而有之,你必须做它由一块块(由线或可能行,如果它是一个文本文件,你正在处理):
Dim downloadRequest As FtpWebRequest =
WebRequest.Create("ftp://downloadftp.example.com/source/path/file.txt")
downloadRequest.Method = WebRequestMethods.Ftp.DownloadFile
downloadRequest.Credentials = New NetworkCredential("username1", "password1")
Dim uploadRequest As FtpWebRequest =
WebRequest.Create("ftp://uploadftp.example.com/target/path/file.txt")
uploadRequest.Method = WebRequestMethods.Ftp.UploadFile
uploadRequest.Credentials = New NetworkCredential("username2", "password2")
Using downloadResponse As FtpWebResponse = downloadRequest.GetResponse(),
sourceStream As Stream = downloadResponse.GetResponseStream(),
targetStream As Stream = uploadRequest.GetRequestStream()
Dim buffer As Byte() = New Byte(10240 - 1) {}
Dim read As Integer
Do
read = sourceStream.Read(buffer, 0, buffer.Length)
If read > 0 Then
' process "buffer" here
targetStream.Write(buffer, 0, read)
End If
Loop While read > 0
End Using
参见:
- 1. 从url下载文件并上传到ftp
- 2. Objective-C FTP上传和下载文件
- 3. 如何从Ftp下载Zip文件#
- 4. 如何从ftp下载文件?
- 5. iOS FTP并发上传和下载
- 6. 下载并上传没有ftp和sftp的文件
- 7. 从FTP传输文件并让用户同时下载它
- 8. Ansible从FTP下载文件
- 9. 从FTP下载xml文件
- 10. 从FTP下载文件
- 11. 从FTP下载文件
- 12. azure存储上传压缩文件,然后再次下载并损坏
- 13. 如何从FTP下载文件,并使用PHP
- 14. 上传使用SFTP从FTP站点下载文件
- 15. 从iPhone通过FTP协议上传/下载文件
- 16. 如何从链接(ftp)下载zip文件并传递用户名和密码?
- 17. FTP正在上传文件时正在下载文件
- 18. 一次上传多个ftp文件?
- 19. Python FTP一次上传多个文件
- 20. 从FTP获取文件列表并下载特定文件
- 21. 通过FTP从FTP下载文件,就像通常下载文件一样?
- 22. PHP大文件上传(再次)
- 23. Ftp文件上传
- 24. 下载文件,保存并再次阅读 - >错误
- 25. 如何监视FTP上传文件夹的新上传文件?
- 26. 在Android上通过FTP下载文件
- 27. 如何下载上传的文件?
- 28. Kloudless:如何下载/上传文件
- 29. 如何下载上传的文件?
- 30. Java-如何下载和上传文件?
我一直在寻找类似的解决方案并通过惊人的发现了很好的代码。检查下面的链接:http://stackoverflow.com/questions/5938893/using-ftp-to-download-each-file-while-getting-the-file-list – GiorgiTBS 2016-12-12 20:00:19