以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 请问upload一讲中,照片上传的个数能否限制 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=170892) |
-- 作者:sunion -- 发布时间:2021/8/10 16:27:00 -- 请问upload一讲中,照片上传的个数能否限制 请问upload一讲中,照片上传的个数能否限制,不限制张数,哪怕就是压缩了文件也比较多,能不能限制比如一次最多选6张,看了视频的讲解,没有提到这个问题 Dim wb As New weui wb.AddForm("","form1","receive.htm") With wb.AddInputGroup("form1","ipg1","文件上传") 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) \'生成网页 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") |
-- 作者:有点蓝 -- 发布时间:2021/8/10 16:31:00 -- Case "receive.htm" For Each key As String In e.Files.Keys if e.Files(key).count > 6 then e.WriteString("不能大于6个图片") return end if
For Each fln As String In e.Files(key) |
-- 作者:sunion -- 发布时间:2021/8/11 19:45:00 -- 代码加入后照片能正常接收,表格中记录会同步。但弹出上传失败的红色标志。请问蓝蓝老师,这是什么问题呢? Case "receive.htm" For Each key As String In e.Files.Keys If e.Files(key).count > 6 Then e.WriteString("照片不能多于6张!!") Return Else Dim nms() As String = {"内容"} Dim drc As DataRow = DataTables("表A").AddNew() For Each nm As String In nms drc(nm) = e.PostValues(nm) Next If key = "up1" Then Dim lst As List(of String) = drc.Lines("照片") For Each fln As String In e.Files(key) Dim n As String = Format(Date.Now,"yyyyMMddHHmmssffff") & fln e.SaveFile(key,fln,"C:\\web\\uploadfiles\\" & n) lst.Add(n) Next drc.Lines("照片") = lst drc.save() End If End If Next e.WriteString("ok") |
-- 作者:有点蓝 -- 发布时间:2021/8/12 8:59:00 -- 把js文件内容发上来看看 |
-- 作者:sunion -- 发布时间:2021/8/12 20:24:00 -- function submitForm(){ show("tst1",2000); var result = submitAjaxForm(\'form1\',\'afterSubmit\'); } function afterSubmit(result){ hide("tst1"); if (result==\'OK\') { show("tst2"); location="upload.htm"; } else{ show("tst3",2000); } } |
-- 作者:有点蓝 -- 发布时间:2021/8/12 21:32:00 -- http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=170973 |