帮助文档下载内容:
Dim ftp1 As New FtpClient
ftp1.Host="196.128.143.28"
ftp1.Account = "foxuser"
ftp1.Password = "138238110"
If ftp1.FileExists("\photo\jz.png") Then '如果存在则下载
If ftp1.Download("\photo\jz.png","c:\data\jz.png") Then
messagebox.Show("下载完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
messagebox.Show("下载失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End
If
Else
messagebox.Show("此文件不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End
If
我自己的下载代码如下:疑问是下载路径为什么要指定好?我想下载到哪就下载到哪是不是更好一点呢?。
Dim ftp1 As New FtpClient
ftp1.Host="192.168.1.72"
ftp1.Account = "bug"
ftp1.Password = "bug"
Dim txt As WinForm.TextBox = e.Form.Controls("textbox2")
If ftp1.FileExists("\FileSys.GetName(txt.value)") Then '如果存在则下载
If ftp1.Download("\FileSys.GetName(txt.value)","c:\data\jz.png") Then
messagebox.Show("下载完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
messagebox.Show("下载失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
Else
messagebox.Show("此文件不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If