老师,用ftp上传文件成功后,重命名,重命名后的文件路径怎么修改呢?
Dim dlg As New OpenFileDialog '定义一个新的SaveFileDialog
dlg.MultiSelect = True
dlg.Filter= "Pdf文件|*.pdf|Word文件|*.doc|Rar文件|*.rar" '设置筛选器
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 = "/公司制度/" & filesys.GetName(f)
If ftp1.DirExists("/公司制度/") = False Then
ftp1.MakeDir("/公司制度/")
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
ftp1.Rename("/公司制度/" & filesys.GetName(f), "/公司制度" & "/" & Date.Today & filesys.GetName(f)) '重命名文件成功!
Else
MessageBox.Show( f & "上传失败" ,"提示" ,MessageBoxButtons.OK,MessageBoxIcon.Question)
End If
End If
Next
r.DataRow.lines("路径") = ls
ftp1.Close
End If