以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 双击截图上传FTP 失败 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=114591) |
-- 作者:yifan3429 -- 发布时间:2018/2/10 13:47:00 -- 双击截图上传FTP 失败 --------------------------- 错误 --------------------------- 编译错误:未声明名称“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
|
-- 作者:有点甜 -- 发布时间:2018/2/10 16:08:00 -- 你没有定义path啊,你的路径是什么,要如下写代码
Dim path As String = projectPath & "attachments/" |
-- 作者:yifan3429 -- 发布时间: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 |
-- 作者:有点甜 -- 发布时间:2018/2/12 8:54:00 -- 1、你这段代码从哪里抄过来的?
2、必须存放在本地,才能把文件上传到ftp,你可以上传后删除文件。
3、图片的路径,或者图片的名字,你可以随便命名。比如 d:\\test.jpg |
-- 作者:yifan3429 -- 发布时间:2018/2/25 1:44:00 -- 知道了 原理没搞清楚 |