Dim dlg As new OpenFileDialog
Dim piv As WinForm.FileManager = e.Form.Controls("FileManager1")
dlg.Filter= "图形文件|*.bmp;*.jpg;*.gif"
dlg.MultiSelect = True '文件多选
If dlg.ShowDialog = DialogResult.OK Then
For Each fname As String In dlg.FileNames
piv.AddFile(fname)
Dim r As Row = Tables("上传文件_Table1").Current
Dim ftp As new FTPClient
ftp.host="*****"
ftp.Port = 21
ftp.account="******"
ftp.password="*****"
ftp.Connect
If ftp.Connected = True Then
msgbox("链接成功,准备上传!")
End If
If ftp.DirExists("\WJY\") = False Then
ftp.MakeDir("\WJY\")) '服务器上生成文件夹
End If
Dim fp As String = "\WJY\" & FileSys.GetName(fname)
e.Form.text = "文件上传中...."
If ftp.Upload(dlg.FileName,fp,True) = True Then '若成功上传
e.Form.text = "上传新文件"
MessageBox.Show("上传成功!","提醒")
If r.IsNull("相片") Then
r("相片") = fp
Else
r("相片") = r("相片") & vbcrlf & fp
End If
End If
msgbox(fp & "/" & fname)
Next
End If