回答
一些鏈接:
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