Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮 Dim t As Row = Tables("集客项目工单清单表").current Dim fls1 As String = "" Dim ftp1 As New FtpClient ftp1.Host="192.168.1.100" ftp1.Port = 23 ftp1.Account = "abc" ftp1.Password = "321" If ftp1.DirExists( "/Homenetwork/" & t("上传资料路径") ) Then '判断目录是否存在 Else ftp1.MakeDir( "/Homenetwork/" & t("上传资料路径") ) '新建目录 End If ftp1.Changedir( "/Homenetwork/" & t("上传资料路径") )'设置路径为当前目录 If ftp1.Upload(dlg.FileName,"Homenetwork/" & filesys.GetName(dlg.FileName)) = True Then Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Else Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If End If
|