谢谢版主,按您的提示研究了下,已经完成了!我的思路是先把文件上传到FTP,然后更新绑定字段内容,图片浏览器就自动下载了.
所以里面有一句上传了再从FTP下载的代码实际没有使用,不知道这个逻辑是否正确,是否还有更好的办法?
代码如下:
Dim nm As String
Dim nr As String = Tables("库存商品").Current("图片") '获取绑定字段当前内容,图片列的Text
Dim ftp1 As New FtpClient
ftp1.Host="xxx.xxx.xx.xxx" 'IP
ftp1.Account = "xxxx" 'FTP账号
ftp1.Password = "xxxxx" 'FTP密码
ftp1.Port = "xxxx" '端口号
Dim dlg As New OpenFileDialog
dlg.MultiSelect = True
dlg.Filter = "图形文件|*.bmp;*.jpg;*.gif;*.png"
If dlg.ShowDialog = DialogResult.OK Then
For Each fl As String In dlg.FileNames
nm = Tables("库存商品").Current("货品名称") & Format(Date.now,"MMddHmmss") '定义文件名,按时间秒数编号
If ftp1.Upload( fl ,"\仓库1\库存商品\" & nm & ".jpg") = True Then '上传图片
' ftp1.Download("\仓库1\库存商品\" & nm & ".jpg",ProjectPath & "Attachments\" & nm & ".jpg") 'FTP下载,发现可以取消
If nr <> "" Then '如果之前没有图片内容
nr = nr & vbcrlf & "\仓库1\库存商品\" & nm & ".jpg"
Else
nr = "\仓库1\库存商品\" & nm & ".jpg"
End If
Else
msgbox( fl & "上传失败!",64,"提示")
End If '
Next
Tables("库存商品").Current("图片") = nr '替换绑定字段Txet
Tables("库存商品").Current.Save
End If