Dim ftp服务器 As String = Tables("表A").current("ftp服务器")
Dim ftp账号 As String = Tables("表A").current("ftp账号")
Dim ftp口令 As String = Tables("表A").current("ftppswd")
Dim 头像文件 As String
Dim 头像 As WinForm.PictureBox = Forms("顶部窗").Controls("pic_用户头像")
If Tables("oa_用户").Current Is Nothing Then
头像.Image = Nothing
Else
If len(trim(Tables("oa_用户").Current.DataRow("头像")))>0 Then
Dim 文件名 As String =trim(Tables("oa_用户").Current.DataRow("头像"))
Dim ftp1 As new ftpclient
ftp1.host =ftp服务器
ftp1.Account =ftp账号
ftp1.password =ftp口令
ftp1.RootDir = "\portrate"
'msgbox( 文件名)
'ftp1.OpenManager()
If vwoa_发布状态 Then
头像文件 ="project\images\portrate\" & 文件名
Else
头像文件 ="images\portrate\" & 文件名
End If
If ftp1.Download(文件名 ,头像文件 ) = True Then
头像.Image = GetImage(头像文件 )
Messagebox.show("用户头像已经更新!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
头像.Image = GetImage("头像_下载失败.png")
End If
Else
头像.Image = GetImage("头像_无.png")
End If
End If
以上代码运行正常。能够看到下载的文件1.png在本机上的地址是不一样的。这是我在使用的一段代码,工程没有完成,尚未优化。