Foxtable(狐表)用户栏目专家坐堂 → 图片,上传到ftp


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

主题:图片,上传到ftp

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/3/20 14:32:00 [只看该作者]

参考代码

 

Dim dlg As New openFileDialog '定义一个新的SaveFileDialog
dlg.MultiSelect = True
If dlg.showDialog = DialogResult.Ok Then '如果用户单击了确定按钮
    Dim ftp1 As new  ftpclient
    ftp1.host="*******"
    ftp1.Account = "ftp001"
    ftp1.password = "******"
    Dim r As Row = Tables("表A").Current
    Dim ls As List(of String) = r.DataRow.Lines("中标通知书")
    For Each f As String In dlg.FileNames
        Dim file = "/公司业绩/" & r("项目名称") & "/" & filesys.GetName(f)
        If ftp1.DirExists("/公司业绩/" & r("项目名称")) = False Then
            ftp1.MakeDir("/公司业绩/" & r("项目名称"))
        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
            Else
                msgbox("上传" & f & "失败")
            End If
        end if
    Next
    r.DataRow.lines("中标通知书") = ls
    ftp1.Close
End If


 回到顶部
总数 16 1 2 下一页