Foxtable(狐表)用户栏目专家坐堂 → 双击截图上传FTP 失败


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

主题:双击截图上传FTP 失败

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


加好友 发短信
等级:九尾狐 帖子:2457 积分:22673 威望:0 精华:0 注册:2011/3/29 17:14:00
双击截图上传FTP 失败  发帖心情 Post By:2018/2/10 13:47:00 [只看该作者]

---------------------------
错误
---------------------------
编译错误:未声明名称“path”。



错误代码:Dim dir As String = FileSys.GetParentPath(path & "/" & f)
---------------------------
确定   
---------------------------



If e.Col.name = "图片" Then
    baseMainForm.WindowState= Windows.forms.FormWindowState.Minimized
    ClipBoard.Clear
    Dim proc As new Process
    proc.File = ApplicationPath & "/capture.exe"
    proc.WaitForClose = True
    proc.Start
      basemainform.WindowState = 2
        Dim dir As String = FileSys.GetParentPath(path & "/" & f)
        If FileSys.DirectoryExists(dir) = False Then FileSys.CreateDirectory(dir)
        ClipBoard.GetImage.save(path & "/" & f)
        e.Row(e.Col.name) = f
        Dim  ftp1 As  New  FtpClient
        ftp1.Host="ftp5001.site4future.com"
        ftp1.Account =  " tocasa"
        ftp1.Password =  "Yifan9108"
        
       
        
        Dim file As String = "2.项目配图"  & "\" &e.Row("订单ID") & "\"  & e.Row("楼层")& "\"  & "3.报价配图"  & "\" & Format( Date.Today,"yyyy-MM-dd")
        For Each s As String In file.split("\")
            path2 = path2 & "/" & s
            If ftp1.DirExists(path2) = False Then
                ftp1.MakeDir(path2)
            End If
        Next
        
        If ftp1.Upload(path & "/" & f, path2 & "/" & e.Row("产品名") &"-" & e.Row("产品号") & ".png") = True Then
            
            
            'If  ftp1.Upload(path & "\" & f, "/" & f) = True Then
            Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
            
        Else
            Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        End If
    End If
    e.cancel = True
    Tables("订单清单").Current.Save() '保存文件的行
End If

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


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

你没有定义path啊,你的路径是什么,要如下写代码

 

Dim path As String = projectPath & "attachments/"


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


加好友 发短信
等级:九尾狐 帖子:2457 积分:22673 威望:0 精华:0 注册:2011/3/29 17:14:00
  发帖心情 Post By:2018/2/11 17:57:00 [只看该作者]

---------------------------
错误
---------------------------
编译错误:“f”是“Private”,因此它在此上下文中不可访问。



错误代码:Dim dir As String = FileSys.GetParentPath(path & "/" & f)
---------------------------
确定   
---------------------------
If e.Col.name = "图片" Then
    baseMainForm.WindowState= Windows.forms.FormWindowState.Minimized
    ClipBoard.Clear
    Dim path As String = projectPath & "attachments/"  我想将文件直接存到 FTP 上  不行存到本地 行  已经设计好是服务器存储
    Dim proc As new Process
    proc.File = ApplicationPath & "/capture.exe"
    proc.WaitForClose = True
    proc.Start
    basemainform.WindowState = 2
    Dim dir As String = FileSys.GetParentPath(path & "/" & f)
    If FileSys.DirectoryExists(dir) = False Then FileSys.CreateDirectory(dir)
    ClipBoard.GetImage.save(path & "/" & f)
    e.Row(e.Col.name) = f
    Dim  ftp1 As  New  FtpClient
    ftp1.Host="4"
    ftp1.Account =  "foxftp"
    ftp1.Password =  ""
    Dim path2 As String = "" 
        Dim file As String = e.Row("类别") & "\" & e.Row("产品") &"\" & e.Row("采购人")
    For Each s As String In file.split("\")
        path2 = path2 & "/" & s
        If ftp1.DirExists(path2) = False Then
            ftp1.MakeDir(path2)
        End If
    Next
    
    If ftp1.Upload(path & "/" & f, path2 & "/" & e.Row("产品") & e.Row("物资编码") & e.Row("采购日期") &".png") = True Then
        
        
        'If  ftp1.Upload(path & "\" & f, "/" & f) = True Then
        Messagebox.show("上传完成!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        
    Else
        Messagebox.show("上传失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    End If
End If
e.cancel = True
Tables("物资仓存表").Current.Save() '保存文件的行
End If

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


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

1、你这段代码从哪里抄过来的?

 

2、必须存放在本地,才能把文件上传到ftp,你可以上传后删除文件。

 

3、图片的路径,或者图片的名字,你可以随便命名。比如 d:\test.jpg


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


加好友 发短信
等级:九尾狐 帖子:2457 积分:22673 威望:0 精华:0 注册:2011/3/29 17:14:00
  发帖心情 Post By:2018/2/25 1:44:00 [只看该作者]

知道了  原理没搞清楚

 回到顶部