以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 文件接收的问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=160822) |
-- 作者:rjh4078 -- 发布时间:2021/2/23 12:04:00 -- 文件接收的问题 Dim wb As New weui If e.PostValues.Count>0 Then If e.PostValues("销售发货单号")<>"" Dim dr As DataRow=DataTables("销售发货单").s ql find("销售发货单号=\'" & e.PostValues("销售发货单号") & "\'") If dr IsNot Nothing Then MessageBox.show("0") For Each key As String In e.Files.Keys MessageBox.show("1") Dim i As Integer=0 For Each fln As String In e.Files(key) MessageBox.show("1") Dim lj As String= ProjectPath & "temp\\" & e.PostValues("销售发货单号") If FileSys.DirectoryExists(lj)=False Then FileSys.CreateDirectory(lj) End If lj=lj & "\\" & e.PostValues("销售发货单号") & "@" & i & "@" & fln e.SaveFile(key,fln,lj) \'保存接收到的文件 i=i+1 Next Next With wb.AddMsgPage("","msgpage","保存成功", e.PostValues("销售发货单号") & "送货回单已上传!") \'生成成功提示页 .AddButton("btn1","返回","upload.htm?dh=" & e.PostValues("销售发货单号") ) End With Else With wb.AddMsgPage("","msgpage","保存失败", "不存在这样的送货单!") \'生成成功提示页 .icon= "Warn" .AddButton("btn1","返回","upload.htm?dh=" & e.PostValues("销售发货单号") ) End With End If Else With wb.AddMsgPage("","msgpage","保存失败", "发货单号不能为空!") \'生成成功提示页 .icon= "Warn" .AddButton("btn1","返回","upload.htm") End With End If 蓝色标记能弹出来,红色标记的部分没有提示,文件保存的代码也不执行,无论是同步还是异步都不行,奇怪了。
[此贴子已经被作者于2021/2/23 12:04:53编辑过]
|
-- 作者:rjh4078 -- 发布时间:2021/2/23 12:06:00 -- 完整函数代码 Dim e As RequestEventArgs = args(0) Dim wb As New weui If e.PostValues.Count>0 Then If e.PostValues("销售发货单号")<>"" Dim dr As DataRow=DataTables("销售发货单").sqlfind("销售发货单号=\'" & e.PostValues("销售发货单号") & "\'") If dr IsNot Nothing Then For Each key As String In e.Files.Keys MessageBox.show("1") Dim i As Integer=0 For Each fln As String In e.Files(key) MessageBox.show("1") Dim lj As String= ProjectPath & "temp\\" & e.PostValues("销售发货单号") If FileSys.DirectoryExists(lj)=False Then FileSys.CreateDirectory(lj) End If lj=lj & "\\" & e.PostValues("销售发货单号") & "@" & i & "@" & fln e.SaveFile(key,fln,lj) \'保存接收到的文件 i=i+1 Next Next With wb.AddMsgPage("","msgpage","保存成功", e.PostValues("销售发货单号") & "送货回单已上传!") \'生成成功提示页 .AddButton("btn1","返回","upload.htm?dh=" & e.PostValues("销售发货单号") ) End With Else With wb.AddMsgPage("","msgpage","保存失败", "不存在这样的送货单!") \'生成成功提示页 .icon= "Warn" .AddButton("btn1","返回","upload.htm?dh=" & e.PostValues("销售发货单号") ) End With End If Else With wb.AddMsgPage("","msgpage","保存失败", "发货单号不能为空!") \'生成成功提示页 .icon= "Warn" .AddButton("btn1","返回","upload.htm") End With End If Else wb.AddForm("","form1","upload.htm") With wb.AddInputGroup("form1","ipg1","回单图片上传") With .AddInput("销售发货单号","销售发货单号","text") If e.getValues.ContainsKey("dh") Then .Value = e.GetValues("dh") End If End With With .AddUploader("up128","照片") .AllowDelete = True \'允许删除 .Accept = "image/*" .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = vars("图片宽度") \'\'.ScaleHeight=vars("图片高度") End With End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "上传", "submit") End With End If e.WriteString(wb.Build) \'生成网页 e.Handled=True |
-- 作者:有点蓝 -- 发布时间:2021/2/23 13:34:00 -- 参考:http://www.foxtable.com/mobilehelp/topics/0106.htm 如果我们将Uploader的Incremental属性设置为True,可以实现: 1、再次选择上传文件,不会覆盖之前上传的文件。 但是,在这种情况下,表单默认的提交功能,将不会上传选择好的文件,我们只能用submitAjaxForm函数提交表单,不过代码依旧很简单。 |
-- 作者:rjh4078 -- 发布时间:2021/2/23 14:21:00 -- 原来这样,再请教下,如何将错误信息回写到Toast? |
-- 作者:有点蓝 -- 发布时间:2021/2/23 14:32:00 -- http://www.foxtable.com/mobilehelp/topics/0082.htm |