Dim ftp1 As New FtpClient
Ftp1.Host = ""
Ftp1.Account = ""
Ftp1.Password = ""
Dim proDir As String = Tables("a").Current("第一类")
Dim dlg As New OpenFileDialog
dlg.Filter= "图形文件|*.bmp;*.jpg;*.gif"
dlg.MultiSelect = True
If dlg.ShowDialog = DialogResult.OK Then
Dim fpath As String = "/a/" & prodir & "/"
Dim str As String = Tables("a").Current("第二列")
For Each fl As String In dlg.FileNames
'Dim fileInfo As new FileInfo(fl)
If ftp1.FileExists(fpath & filesys.GetName(fl)) Then
Messagebox.show("同名文件","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
判断重名后,这里如何将上传的自动改名为原文件名+ -1 ,并判断文件名是否重复,如果不重复 上传,如果重复自动
+ -2 一次类推
或者有自动重命名的其他方式
If Ftp1.Upload(,,True) = True Then
str &= fpath & FileSys.GetName(fl) & vbcrlf --这里的路径保存
Else
If Ftp1.Upload(fl,fpath & filesys.GetName(fl),True) = True Then
str &= fpath & FileSys.GetName(fl) & vbcrlf
Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
End If
Next
Tables("a").Current("第二列")= str
Tables("a").Current.Save()
End If
[此贴子已经被作者于2017/2/26 14:29:27编辑过]