以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 照片上传失败,恳请各位大神指点 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=170850) |
-- 作者:sunion0769 -- 发布时间:2021/8/9 15:47:00 -- 照片上传失败,恳请各位大神指点 看了说明书中的照片数据的上传和照片的压缩,但尝试了几次都是上传失败,不知道问题出在那里? 恳请各位大神指点,看看代码那里问题,希望各路大神能帮我把错误代码纠正一下,感激啊 Select Case e.Path Case "upload.htm" Dim wb As New weui wb.AddForm("","form1","receive.htm") With wb.AddInputGroup("form1","ipg1","文件上传") .AddInput("姓名","姓名","Text") 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/ajaxform.js\'></script>") \'引入脚本文件 e.WriteString(wb.Build) \'生成网页 Case "receive.htm" Dim wb As New weui 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, ProjectPath & "Attachments\\" & fln) e.SaveFile(key, fln, "c:\\web\\uploadfiles\\" & 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 Select
[此贴子已经被作者于2021/8/9 15:48:31编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/8/9 15:59:00 -- 参考这里做:http://www.foxtable.com/mobilehelp/topics/0251.htm 必须使用js提交数据
|
-- 作者:sunion0769 -- 发布时间:2021/8/9 16:12:00 -- 已经调用了ajaxform.js文件,文件也存放到了d:\\web"目录下子目录lib |
-- 作者:sunion0769 -- 发布时间:2021/8/9 16:14:00 -- 不知道代码哪里出了问题?蓝大神能测试帮忙测试一下吗? 刚开始从教程在学习不久,希望能得到您的详细指导
|
-- 作者:有点蓝 -- 发布时间:2021/8/9 16:22:00 -- 提交数据要使用js,不能使用sibmit With wb.AddButtonGroup("form1","btg1",True).Add("btn1", "确定", "button").Attribute= "onclick=\'submitForm()\'" \'调用js函数上传 End With 接收代码去掉下面代码 With wb.AddMsgPage("","msgpage","增加成功", "好好学习,天天向上") \'生成成功提示页 .AddButton("btn1","继续增加","upload.htm") End With e.WriteString(wb.Build) 改为 e.WriteString(“OK”) |