参考代码
Dim dlg As New openFileDialog '定义一个新的SaveFileDialog
dlg.MultiSelect = True
If dlg.showDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim ftp1 As new ftpclient
ftp1.host="*******"
ftp1.Account = "ftp001"
ftp1.password = "******"
Dim r As Row = Tables("表A").Current
Dim ls As List(of String) = r.DataRow.Lines("中标通知书")
For Each f As String In dlg.FileNames
Dim file = "/公司业绩/" & r("项目名称") & "/" & filesys.GetName(f)
If ftp1.DirExists("/公司业绩/" & r("项目名称")) = False Then
ftp1.MakeDir("/公司业绩/" & r("项目名称"))
End If
Dim Result As DialogResult
If ftp1.FileExists(file) Then
Result = MessageBox.Show("文件已经存在,是否覆盖?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
End If
If result = Nothing OrElse result = DialogResult.Yes Then
If ftp1.Upload(f,file,True) = True Then
If ls.contains(file) = False Then
ls.add(file)
end if
Else
msgbox("上传" & f & "失败")
End If
end if
Next
r.DataRow.lines("中标通知书") = ls
ftp1.Close
End If