Dim ftp1 As New FtpClient ftp1.Host=Tables("FTPIP").Current("FTPhost") ftp1.Account = Tables("FTPIP").Current("FTPAccount") ftp1.Password = Tables("FTPIP").Current("FTPpassword") Dim r As Row = Tables("员工信息_员工信息").current Dim l As String = "/身份证/"& r("证件号码") + r("员工姓名") Dim dlg As New FolderBrowserDialog '选择目录对话框 dlg.Description = "选择文件夹" '对话框的说明 dlg.ShowNewFolderButton = False '不显示"新建文件夹"按钮 If dlg.ShowDialog = DialogResult.Ok Then '如果单击确定 MessageBox.Show("你选择的目录是:" & dlg.SelectedPath ,"提示") Dim f As String = dlg.SelectedPath & "\" & r("员工姓名") & "1.jpg" Dim f1 As String = dlg.SelectedPath & "\" & r("员工姓名") & "2.jpg" Dim sf As String = r("证件图1") Dim sf1 As String = r("证件图2") If FileSys.DirectoryExists(dlg.SelectedPath ) Then '如果指定的文件目录存在 If ftp1.DirExists(l) Then Messagebox.Show("服务器文件目录已经存在!","提示") If FileSys.FileExists(f) Then If ftp1.Upload(f,sf) = True Then Messagebox.show("" &r("员工姓名")&" 身份证正面上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Else Messagebox.show("" &r("员工姓名")&" 身份证正面上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If Else Messagebox.show("没有找到 " &r("员工姓名")&" 的身份证(正面)图片!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If If FileSys.FileExists(f1) Then If ftp1.Upload(f1,sf1) = True Then Messagebox.show("" &r("员工姓名")&" 身份证反面上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Else Messagebox.show("" &r("员工姓名")&" 身份证反面上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If Else Messagebox.show("没有找到 " &r("员工姓名")&" 的身份证(反面)图片!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If If DataTables("员工信息_员工信息").HasChanges Then DataTables("员工信息_员工信息").Save End If Else If ftp1.MakeDir(l) Then Messagebox.Show("创建目录成功!") If FileSys.FileExists(f) Then If ftp1.Upload(f,sf) = True Then Messagebox.show("" &r("员工姓名")&" 身份证正面上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Else Messagebox.show("" &r("员工姓名")&" 身份证正面上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If Else Messagebox.show("没有找到 " &r("员工姓名")&" 的身份证(正面)图片!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If If FileSys.FileExists(f1) Then If ftp1.Upload(f1,sf1) = True Then Messagebox.show("" &r("员工姓名")&" 身份证反面上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Else Messagebox.show("" &r("员工姓名")&" 身份证反面上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If Else Messagebox.show("没有找到 " &r("员工姓名")&" 的身份证(反面)图片!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If If DataTables("员工信息_员工信息").HasChanges Then DataTables("员工信息_员工信息").Save End If Else Messagebox.Show("创建目录失败,请联系管理员!") End If End If Else Messagebox.Show("源文件目录不存在!","提示") End If Dim idx As Integer = Tables("员工信息_员工信息").position If idx <> 0 Then Tables("员工信息_员工信息").position = 0 Tables("员工信息_员工信息").position = idx Else Tables("员工信息_员工信息").position += 1 Tables("员工信息_员工信息").position = idx End If End If
|