以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  双击截图网络版  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=114342)

--  作者:yifan3429
--  发布时间:2018/2/3 17:50:00
--  双击截图网络版
If e.Col.name = "图片" Then
    Dim dr As DataRow = e.Row.DataRow
    If dr.IsNull ("类别") Or Dr.IsNull("楼层")  Or Dr.IsNull("产品名") Or Dr.IsNull("单位") Or Dr.IsNull("房间") Then
        MessageBox.show("带 * 为必填","提示")
        e.cancel = True
    Else
        baseMainForm.WindowState= Windows.forms.FormWindowState.Minimized
        ClipBoard.Clear
        Dim proc As new Process
        proc.File = ApplicationPath & "/capture.exe"
        proc.WaitForClose = True
        proc.Start
        If ClipBoard.GetImage IsNot Nothing Then
            Dim f As String =   e.Row("编号") & "\\" & e.Row("楼层") &"\\" & e.Row("房间")&"\\" & e.Row("产品名") & e.Row("产品号") & e.Row("单位") &".png"
            Dim path As String = e.Col.DataCol.DefaultFolder
            If path = "" Then                \'\'\'
                path =Vars("IPM")
                \'msgbox(1)
            End If
            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=
            ftp1.Account =  
            ftp1.Password =  
            Dim path2 As String = ""
            Dim file As String = "1.艾迪尔报价库" & "\\"  & e.Row("编号") & "\\" & e.Row("楼层") &"\\" & e.Row("房间")
            \'& e.Row("产品名") & e.Row("产品号") & e.Row("单位") &".png"
            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
    End If
End If


这个代码是同时写入本地和FTP  我想改成纯 FTP 写入  不需要本地存储   还有   path =Vars("IPM")  

DataTables("报价清单").DataCols("图片").DefaultFolder = Vars("IPM")
DataTables("报价清单").DataCols("图片").SourceFolder = "D:\\"
上面的代码只能写入默认地址  我想远程的  地址  账号 密码 路径  也在AfterOpenProject 写入   
 
[此贴子已经被作者于2018/2/3 17:50:44编辑过]

--  作者:wei0769
--  发布时间:2018/2/4 9:24:00
--  

--  作者:有点甜
--  发布时间:2018/2/4 18:49:00
--  
以下是引用yifan3429在2018/2/3 17:50:00的发言:
 
DataTables("报价清单").DataCols("图片").DefaultFolder = Vars("IPM")
DataTables("报价清单").DataCols("图片").SourceFolder = "D:\\"
 
上面的代码只能写入默认地址  我想远程的  地址  账号 密码 路径  也在AfterOpenProject 写入   
 
[此贴子已经被作者于2018/2/3 17:50:44编辑过]

 

参考 http://www.foxtable.com/webhelp/scr/2040.htm

 


--  作者:yifan3429
--  发布时间:2018/2/6 16:24:00
--  
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
    End If
End If


这个是写反了吗,每次都显示上传失败  实际上文件已上传

--  作者:有点甜
--  发布时间:2018/2/6 16:45:00
--  

加入代码,看弹出的路径是否正确

 

msgbox(path & "/" & f)

msgbox(path2 & "/" & e.Row("产品名") & e.Row("产品号") & e.Row("单位") &".png")

msgbox(path & "\\" & f)

msgbox("/" & f)