以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- uploader增强功能,手机上传照片后提示上传失败 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=176017) |
-- 作者:gaolei -- 发布时间:2022/3/27 18:46:00 -- uploader增强功能,手机上传照片后提示上传失败 Dim wb As New weui Select Case e.Path Case "addnew.htm" If e.PostValues.Count = 0 Then wb.AddForm("","form1","addnew.htm") With wb.AddInputGroup("form1","ipg1","收款资料") .AddInput("项目名称","项目名称:","Text") .AddInput("日期","收款日期:","date") .AddInput("业态","业态分类:","Text") .AddInput("楼栋号","房产楼栋:","Text") .AddInput("分期","房产分期:","Text") .AddInput("房号","客户房号:","Text") .AddInput("收款摘要","收款摘要:","Text") .AddInput("客户姓名","客户姓名:","Text")\'前一个"姓名"是ID,后一个"姓名"是标题 .AddInput("收款阶段","收款阶段:","Text") .AddInput("收款银行","收款银行:","Text") .AddInput("收款金额","收款金额:","number") With .AddUploader("up1","其他附件",True) .Accept = "image/*" \'允许使用相册和相机 .AllowDelete = True \'允许用户删除图片 .Incremental = True \'允许重复选择文件或连续拍照 End With End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "确定", "button").Attribute= "" \'调用js函数上传 End With wb.AddToast("","tst1", "正在上传",1) wb.AddToast("","tst2", "上传成功",0) wb.AddToast("","tst3", "上传失败",0).Icon= "warn" wb.AppendHTML("<script src=\'./lib/ajaxform.js\'></script>") \'引入脚本文件 e.WriteString(wb.Build) \'生成网页 Else Dim nms() As String = {"日期","业态","房号","客户姓名","收款银行","收款金额","项目名称","分期","收款摘要","收款阶段","楼栋号"}\'不能为空的列名数组 For Each nm As String In nms If e.PostValues.ContainsKey(nm) = False Then \'生成错误提示页 With wb.AddMsgPage("","msgpage","增加失败", nm & "列不能为空!") .icon = "Warn" \'改变图标 .AddButton("btn1","返回").Attribute = "" End With e.WriteString(wb.Build) Return \'必须返回 End If Next nms = New String(){"日期","业态","房号","客户姓名","收款银行","收款金额","项目名称","分期","收款摘要","收款阶段","楼栋号"}\'重新定义了nms数组,增加了两列. Dim dr As DataRow = DataTables("销售收款").AddNew() For Each nm As String In nms If e.PostValues.ContainsKey(nm) Then dr(nm) = e.PostValues(nm) End If Next For Each key As String In e.Files.Keys If key = "up1" Then For Each fln As String In e.Files(key) e.SaveFile(key, fln, ProjectPath & "Attachments\\" & fln) Next dr.Lines("其他附件") = e.Files(key) End If Next \'保存并生成增加成功提示页面 dr.save() With wb.AddMsgPage("","msgpage","增加成功", "好好学习,天天向上") \'生成成功提示页 .AddButton("btn1","继续增加","addnew.htm") End With e.WriteString(wb.Build) End If End Select 老师,这是我自己写的一段代码,我从手机上点击确定按钮之后,销售收款表里面立刻蹦出来调用的目标发生异常未将对象引用设置到对象的实例,这个错误关掉之后手机上显示上传失败,但是还是能正常增加一行并且把手机上的信息存储到销售收款表里面的,但是上面红色的代码并不能执行,能否帮忙看一下是啥原因,谢谢了 |
-- 作者:有点蓝 -- 发布时间:2022/3/27 20:47:00 -- 成功接收数据后只能返回OK Case "receive.htm"
For Each key As String In e.Files.Keys For Each fln As String In e.Files(key) e.SaveFile(key,fln,"d:\\web\\uploadfiles\\" & fln) \'保存接收到的文件 Next Next e.WriteString("OK") End Select [此贴子已经被作者于2022/3/27 20:47:37编辑过]
|
-- 作者:gaolei -- 发布时间:2022/3/29 13:22:00 -- 老师,您回复的内容,我还是有点不明白,能否再点拨一下,辛苦您啦 |
-- 作者:有点蓝 -- 发布时间:2022/3/29 13:45:00 -- 接收数据的代码里只能返回OK表示成功了,因为js里只判断了OK function afterSubmit(result){ hide("tst1"); if (result==\'OK\') { show("tst2"); location="upload.htm"; } else{ show("tst3",2000); } } ………… Else Dim nms() As String = {"日期","业态","房号","客户姓名","收款银行","收款金额","项目名称","分期","收款摘要","收款阶段","楼栋号"}\'不能为空的列名数组 For Each nm As String In nms If e.PostValues.ContainsKey(nm) = False Then \'生成错误提示页 e.WriteString(“出错了”) Return \'必须返回 End If Next nms = New String(){"日期","业态","房号","客户姓名","收款银行","收款金额","项目名称","分期","收款摘要","收款阶段","楼栋号"}\'重新定义了nms数组,增加了两列. Dim dr As DataRow = DataTables("销售收款").AddNew() For Each nm As String In nms If e.PostValues.ContainsKey(nm) Then dr(nm) = e.PostValues(nm) End If Next For Each key As String In e.Files.Keys If key = "up1" Then For Each fln As String In e.Files(key) e.SaveFile(key, fln, ProjectPath & "Attachments\\" & fln) Next dr.Lines("其他附件") = e.Files(key) End If Next \'保存并生成增加成功提示页面 dr.save() e.WriteString("OK") End If End Select |