以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 上传图片 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=169768) |
-- 作者:BG小白 -- 发布时间:2021/6/29 18:06:00 -- 上传图片 Select Case e.Path Case "addnewxb.htm" If e.PostValues.Count = 0 Then wb.AddForm("","form1","addnewxb.htm") With wb.AddInputGroup("form1","ipg1","增加补货") .AddSelect("店铺","店铺","|一店|二店|三店|四店") .AddInput("补货数量","补货数量","number") \'.AddUploader("up1","图片",True) 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("btn2", "重置", "reset") \'重置 End With 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() {"店铺","补货数量"} 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 & "xb\\" & fln) Next dr.Lines("图片") = e.Files(key) End If Next 为什么用黄色部分就可以把照片传上去,但是我想增加紫色部分的功能,用紫色部分照片是传不上去 wb.AddForm("","form1","addnewxb.htm") With wb.AddInputGroup("form1","ipg1","增加补货") .AddSelect("店铺","店铺","|一店|二店|三店|四店") .AddInput("补货数量","补货数量","number") .AddUploader("up1","图片",True) .AllowDelete = True \'允许删除 .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 400 \'自动压缩图片宽度为400个像素,高度等比例压缩 End With 这样写呢,又报错,该怎么写呢 |
-- 作者:有点蓝 -- 发布时间:2021/6/29 20:44:00 -- 参考:http://www.foxtable.com/mobilehelp/topics/0106.htm 如果我们将Uploader的Incremental属性设置为True,可以实现: 1、再次选择上传文件,不会覆盖之前上传的文件。 但是,在这种情况下,表单默认的提交功能,将不会上传选择好的文件,我们只能用submitAjaxForm函数提交表单,不过代码依旧很简单。 |
-- 作者:BG小白 -- 发布时间:2021/6/29 21:52:00 -- Select Case e.Path Case "addnewxb.htm" If e.PostValues.Count = 0 Then wb.AddForm("","form1","addnewxb.htm") With wb.AddInputGroup("form1","ipg1","增加补货") .AddSelect("店铺","店铺","|一店|二店|三店|四店") .AddInput("补货数量","补货数量","number") 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("btn2", "重置", "reset") \'重置 End With e.WriteString(wb.Build) 这样写传不上去图片 Select Case e.Path Case "addnewxb.htm" If e.PostValues.Count = 0 Then wb.AddForm("","form1","addnewxb.htm") With wb.AddInputGroup("form1","ipg1","增加补货") .AddSelect("店铺","店铺","|一店|二店|三店|四店") .AddInput("补货数量","补货数量","number") .AddUploader("up1","图片",True) End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "确定", "submit") .Add("btn2", "重置", "reset") \'重置 End With e.WriteString(wb.Build) 这样写能传照片,但是不能开启功能 wb.AddForm("","form1","addnewxb.htm") With wb.AddInputGroup("form1","ipg1","增加补货") .AddSelect("店铺","店铺","|一店|二店|三店|四店") .AddInput("补货数量","补货数量","number") .AddUploader("up1","图片",True) .AllowDelete = True \'允许删除 .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 400 \'自动压缩图片宽度为400个像素,高度等比例压缩 End With 这样写呢,又报错,该怎么写呢 |
-- 作者:有点蓝 -- 发布时间:2021/6/29 21:55:00 -- 请仔细认真看看2楼帮助说明 |
-- 作者:BG小白 -- 发布时间:2021/6/29 22:05:00 -- 我看了 Select Case e.Path Case "upload.htm" Dim wb As New weui wb.AddForm("","form1","receive.htm") With wb.AddInputGroup("form1","ipg1","文件上传") With .AddUploader("up128","照片",True) .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) \'生成网页 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 和我不同的地方,就是蓝色标注出来的,js函数是显示正在上传,var result = submitAjaxForm(\'form1\',\'afterSubmit\');这个我不理解什么意思,增加了一个receive.htm页面,其他没有什么问题啊
|
-- 作者:有点蓝 -- 发布时间:2021/6/29 22:11:00 -- var result = submitAjaxForm(\'form1\',\'afterSubmit\');就是通过js提交上传数据。然后通过receive.htm页面接收数据 |
-- 作者:BG小白 -- 发布时间:2021/6/29 22:29:00 -- 好的,我再试一下 |