以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 图片文件判断是否重复 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=147182) |
-- 作者:nuonuo384 -- 发布时间:2020/3/11 15:43:00 -- 图片文件判断是否重复 老师: 我在窗口中添加按钮,点击后在指定列表框添加附件,代码如下。 因为如果子目录中同名会覆盖,怎样判断该名称是否存在? Dim ftp1 As New FtpClient Dim sourceFileName, destinationFileName As String ftp1.Host = "47.102.150.86" ftp1.Account = "test" ftp1.Password = "67963270" ftp1.UTF8 = True If ftp1.DirExists("\\" & user.name & "\\" & Date.Today ) = False Then ftp1.MakeDir("\\" & user.name & "\\" & Date.Today ) End If If dlg.showdialog = dialogresult.ok Then For Each fl As String In dlg.FileNames flname = fl.Substring(fl.LastIndexOf("\\")+1) flname = "\\" & user.name & "\\" & Date.Today & "\\" & flname ls = ls & "|" & flname & "|" lst1.ComboList = ls If ftp1.Upload(fl, flname) = True Then Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) Else Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If Next End If |
-- 作者:有点蓝 -- 发布时间:2020/3/11 15:45:00 -- FileExists 判断指定的文件是否存在,语法: FileExists(FileName) FileName:要判断的文件名,含路径。 示例 Dim ftp1 As New FtpClient |