Foxtable(狐表)用户栏目专家坐堂 → ftp文件上传判断


  共有1440人关注过本帖平板打印复制链接

主题:ftp文件上传判断

帅哥哟,离线,有人找我吗?
cuicuibing
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:404 积分:3561 威望:0 精华:0 注册:2014/1/8 17:12:00
ftp文件上传判断  发帖心情 Post By:2017/2/26 14:27:00 [只看该作者]

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编辑过]

 回到顶部