Foxtable(狐表)用户栏目专家坐堂 → 上传过程出现意外错误,上传失败


  共有2136人关注过本帖树形打印复制链接

主题:上传过程出现意外错误,上传失败

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


加好友 发短信
等级:幼狐 帖子:74 积分:605 威望:0 精华:0 注册:2016/6/13 18:16:00
上传过程出现意外错误,上传失败  发帖心情 Post By:2017/5/21 16:15:00 [只看该作者]

Dim 接收用户  As String
接收用户 = e.Form.Controls("接收用户").text
Dim ftp As new FTPClient
    ftp.host="*****"
    ftp.Port = 21
    ftp.account="******"
    ftp.password="*****"
    ftp.Connect
    If ftp.Connected = True Then
        msgbox("链接成功,准备上传!")
    End If
Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "图形文件|*.bmp;*.jpg;*.gif;*.png" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
    '____________________
    If FileSys.FileExists( dlg.FileName )   Then '判断选择的文件是否存在 ,其中FileSys.GetName是获取不含路径文
        Dim F As String=FileSys.GetName( dlg.FileName)
        Dim File As String= ProjectPath & "Attachments\"  &  _UserName & "\"  &  f
        Dim File2 As String= Vars("网络文件夹") & _UserName & "\" & f
        e.Form.Controls("等待").Visible = True '控件显示
        e.Form.Controls("等待").TopMost= True '最顶端
        Application.DoEvents()    '即刻暂停代码的执行,重新绘制控件后,继续执行代码.
        '-----------判断服务器上是否的相同文件名的文件
        Dim File3 As String=File2
        Dim Sum As Integer
        Dim i As Integer
        For i = 1 To 10000
            Sum = Sum + 1
            If Sum >1  Then
                File2=Vars("网络文件夹") & _UserName & "\" & "(" & Sum & ")" & F
            End If
            If ftp1.FileExists( File2 )=False   Then '判断文件是否存在,没有的停止计数
                Exit For
            End If
        Next
        FileSys.CopyFile(dlg.FileName ,File, True) '复制到本地文件夹
        ftp1.Upload(dlg.FileName ,File2, True) '复制到服务器文件夹
        If ftp1.FileExists( File2 )   Then '判断文件是否存在

执行后出现“上传过程出现意外错误,上传失败”,不知道代码哪的问题


 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/5/22 10:09:00 [只看该作者]

 打开管理窗口测试上传能否正常?

 

Dim ftp1 As New FtpClient
ftp1.Host="196.128.143.28"
ftp1.Account = "foxuser"
ftp1.Password = "138238110"
ftp1.OpenManager()

 

 单独写upload代码能否正常?


 回到顶部