以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 员工表没有接受到姓名、性别、照片的提交信息,代码出错在哪里呢? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=170826) |
-- 作者:sunion -- 发布时间:2021/8/8 23:51:00 -- 员工表没有接受到姓名、性别、照片的提交信息,代码出错在哪里呢? 代码出错:照片压缩到"c:\\web\\uploadfiles正常,但员工表没有接受到照片的提交信息,显示上传失败。 Case "upload.htm" If e.PostValues.Count = 0 Then wb.AddForm("","form1","receive.htm") With wb.AddInputGroup("form1","ipg1","增加员工") .AddInput("姓名","姓名","Text") \'前一个"姓名"是ID,后一个"姓名"是标题 .AddInput("性别","性别","Text") \' .AddSelect("学历","学历","大专|本科|硕士|博士") With.AddUploader("up128","文章照片",True) .AllowDelete = True \'允许删除 .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 400 \'自动压缩图片宽度为400个像素,高度等比例压缩 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 = {"姓名","性别"} Dim dz As DataRow = DataTables("员工").AddNew() For Each nm As String In nms dz(nm) = e.PostValues(nm) 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","继续增加","upload.htm") End With e.WriteString(wb.Build) End If \'===================================照片上传 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,"c:\\web\\uploadfiles\\" & fln) \'保存接收到的文件 Next Next e.WriteString("OK") [此贴子已经被作者于2021/8/9 0:06:02编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/8/9 8:31:00 -- 看看:http://www.foxtable.com/mobilehelp/topics/0007.htm 方法1、到Case "receive.htm"里接收和保存数据 2、 wb.AddForm("","form1","receive.htm") 改为 wb.AddForm("","form1","upload.htm")
|
-- 作者:sunion -- 发布时间:2021/8/9 11:58:00 -- 蓝哥哥,现在表格能够接收信息(图一)、C盘对应文件夹也能收到上传的照片(图二),但依然出现了错误提示(图三) Dim wb As New weui Select Case e.Path Case "upload.htm" \'----------------------压缩照片 wb.AddForm("","form1","receive.htm") With wb.AddInputGroup("form1","ipg1","文件上传") .AddInput("姓名","姓名","Text") \'前一个"姓名"是ID,后一个"姓名"是标题 .AddInput("年龄","年龄","number") \' .AddSelect("学历","学历","大专|本科|硕士|博士") With .AddUploader("up1","照片",True) .AllowDelete = True \'允许删除 .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 400 \'自动压缩图片宽度为400个像素,高度等比例压缩 End With End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "确定", "submit") \' .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/ajaxformphoto.js\'></script>") \'引入脚本文件 e.WriteString(wb.Build) \'生成网页 \'--------------------接受数据-------------------- Case "receive.htm" Dim nms() As String = {"姓名","年龄"} Dim dr As DataRow = DataTables("员工").AddNew() For Each nm As String In nms dr(nm) = e.PostValues(nm) 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,"c:\\web\\uploadfiles\\" & fln) \'保存接收到的文件 \' e.SaveFile(key, fln, ProjectPath & "Attachments\\" & fln) Next dr.Lines("照片") = e.Files(key) End If Next \'保存并生成增加成功提示页面 dr.save() With wb.AddMsgPage("","msgpage","增加成功", "好好学习,天天向上") \'生成成功提示页 .AddButton("btn1","继续增加","upload.htm") End With e.WriteString(wb.Build) e.WriteString("OK") End Select
[此贴子已经被作者于2021/8/9 12:01:44编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/8/9 12:12:00 -- 去掉下面代码 With wb.AddMsgPage("","msgpage","增加成功", "好好学习,天天向上") \'生成成功提示页 .AddButton("btn1","继续增加","upload.htm") End With e.WriteString(wb.Build) |
-- 作者:sunion -- 发布时间:2021/8/9 12:26:00 -- 如果去掉这个代码,就回不到upload.htm页面了。只出现了一张写着“ok”的白色页面 |
-- 作者:有点蓝 -- 发布时间:2021/8/9 13:28:00 -- 到js里返回:http://www.foxtable.com/mobilehelp/topics/0251.htm |