If e.DataCol.name ="图片" Dim dlg As New OpenFileDialog dlg.MultiSelect = True dlg.Filter= "图片文件|*.jpg|图片文件|*.jpeg" '设置筛选器 If dlg.ShowDialog = DialogResult.OK Then Dim ftp1 As New FtpClient ftp1.Host="220.211.220.211" ftp1.Account = "ftpuser" ftp1.Password = "000000" ftp1.RootDir = "/localuser/photo/" & e.DataRow("项目编号") For Each fl As String In dlg.FileNames Dim Randstr As String =Rand.NextString(6) If ftp1.Upload(fl, ftp1.RootDir & e.DataRow("档案编号")& e.DataRow("权利人") & Randstr & ".jpg",True) = True Then If e.DataRow.Isnull("图片") Then e.DataRow("图片") = e.DataRow("档案编号")& e.DataRow("权利人") & Randstr & ".jpg" Else e.DataRow("图片") = e.DataRow("图片") & vbcrlf & e.DataRow("档案编号")& e.DataRow("权利人") & Randstr & ".jpg" End If Messagebox.show(fl & "-上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Else Messagebox.show( fl & "-上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If Next End If End If
|