老师,我用按钮通过ftp上传文件,突然不能不用了,麻烦看看什么问题,之前一直正常,而且我通过表格直接点上传,连接都没问题。
Dim dlg As New openFileDialog '定义一个新的SaveFileDialog
dlg.MultiSelect = True
If dlg.showDialog = DialogResult.Ok Then '如果用户单击了确定按钮
Dim ftp1 As new ftpclient
ftp1.host=""
ftp1.Account = ""
ftp1.password = ""
Dim r As Row = Tables("采购合同管理").Current
Dim ls = r.DataRow.Lines("采购合同扫描件")
For Each f As String In dlg.FileNames
Dim file = "/采购合同管理/" & r("项目名称") & "/" & r("序号") & "/" & filesys.GetName(f)
If ftp1.DirExists("/采购合同管理/" & r("项目名称")) = False Then
ftp1.MakeDir("/采购合同管理/" & r("项目名称"))
End If
If ftp1.DirExists("/采购合同管理/" & r("项目名称") & "/" & r("序号")) = False Then
ftp1.MakeDir("/采购合同管理/" & r("项目名称") & "/" & 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
MessageBox.Show( f & "上传失败" ,"提示" ,MessageBoxButtons.OK,MessageBoxIcon.Question)
End If
End If
Next
r.DataRow.lines("采购合同扫描件") = ls
ftp1.Close
End If