以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  FTP上传如何覆盖同名文件  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=67467)

--  作者:seal51
--  发布时间:2015/4/24 19:34:00
--  FTP上传如何覆盖同名文件
Dim fp As String = "\\gongling\\web\\FTP测试\\" & Tables("表A").current("自制")
Dim sts As List(of String) = ftp.GetFileList(fp)   \'获取当前目录的文件列表
If sts.Count >0 Then
for each st as string in sts
If st = fname Then
MessageBox.Show("服务器上存在同名文件!","提醒")
Return  \'这里简化了操作, 可以自己做是否覆盖的功能
End If
next 
e.form.text = "ftp管理器  文件上传中....”
If ftp.upload(dlg.FileName,ftp & "\\" & fname) =Ture Then   \'若成功上传
Functions.Execute("刷新ListView“)   ‘这个是自定义函数
e.Form.text = "ftp管理器"
MessageBox.Show("上传成功","提醒")
Else
MessageBox.Show("上传失败","提醒")
e.Form.text = "ftp管理器"
end if
end if 

--  作者:狐狸爸爸
--  发布时间:2015/4/24 22:28:00
--  
如果存在存同名文件,用代码删除再上传,就等于是覆盖了。