以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 【weui】移动开发时,如何实现多个文件批量选择上传呢? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=160151) |
||||
-- 作者:cnsjroom -- 发布时间:2021/1/22 13:05:00 -- 【weui】移动开发时,如何实现多个文件批量选择上传呢? 【weui】移动开发时,如何实现多个文件批量选择上传呢? 红色部分代码启动后,其他weui内容又全部不在了 只有红色代码部分内容显示【且在手机端无法一次性选择多个文件,在电脑端可以一次性选择多个文件,有没有办法在手机端也可以选择多个文件呢?】 Dim div As String = FileSys.ReadAllText(ProjectPath & "\\qz.txt") wb.AddPageTitle("","ph1","记录上传","【三会一课系统】") wb.AddForm("","form1","upload.htm") With wb.AddInputGroup("form1","ipg1","基础信息") \'前一个"姓名"是ID,后一个"姓名"是标题 With .AddSelect("单位名称","单位名称","|" & dt.sqlGetComboListString("单位名称")) .Attribute = """ End With With .AddSelect("支部名称","支部名称","") .Attribute = """ End With .AddSelect("会议编号","会议编号","") .AddSelect("姓名","姓名","" ) .AddSelect("图片类别","图片类别","|会议记录|学习记录|学习心得|其它材料") End With Dim sb As New StringBuilder sb.appendLine("<form enctype=\'multipart/form-data\' action=\'accept.htm\' method=\'post\' id=\'form1\' name=\'form1\'>") sb.appendLine("单文件上传: <input type=\'file\' name=\'up1\' id=\'up1\'><br/><br/>") sb.appendLine("多文件上传: <input type=\'file\' name=\'up2\' id=\'up2\' multiple><br/><br/>") sb.appendLine("<input Type=\'submit\' name=\'Sumbit\' id=\'Sumbit\' value=\'确定\'>") sb.appendLine("</form>") e.WriteString(sb.ToString) wb.AddTopTips("","toptip1","请输入单位名称和支部名称!") With wb.AddInputGroup("form1","ipg2","文件上传") \'文件上传 With.AddUploader("up1","请选择图片",True) \'True表示允许上传多个文件 .AllowDelete = True \'允许删除 .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 1024 End With End With \'End With wb.InsertHTML(div) With wb.AddButtonGroup("form1","btg1",False) .Add("btn1", "确定上传", "button").Attribute= "" \'调用js函数上传 .Add("btn2", "取消上传", "submit").FormAction = "default.htm" \'wb.InsertHTML("<div id=\'someelement\'></div>") End With With wb.AddDialog("","dlg1", "增加成功","好好学习,天天向上!") .AddButton("btnOK","继续增加","default.htm") 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) 如果取消红色部分代码 代码只能实现一次性选择一个文件进行多次上传,有没有办法实现一次性选择多个文件并一次上传呢? |
||||
-- 作者:浙江仔 -- 发布时间:2021/1/22 13:23:00 -- wb和sb只能用一个 可以用wb.AppendHTML("<form enctype=\'multipart/form-data\' action=\'accept.htm\' method=\'post\' id=\'form1\' name=\'form1\'>")的方式试试看
|
||||
-- 作者:有点蓝 -- 发布时间:2021/1/22 13:38:00 -- http://www.foxtable.com/mobilehelp/topics/0097.htm |
||||
-- 作者:cnsjroom -- 发布时间:2021/1/22 14:10:00 -- 回复:(有点蓝)http://www.foxtable.com/mobilehelp... 老师 根据帮助 现在实现代码如下: With wb.AddInputGroup("form1","ipg2","文件上传") \'文件上传 With.AddUploader("up1","请选择图片",True) \'True表示允许上传多个文件 .AllowDelete = True \'允许删除 .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 1024 End With With wb.AddInputGroup("form1","ipg3","文件上传") \'文件上传 wb.InsertHTML("<form enctype=\'multipart/form-data\' action=\'accept.htm\' method=\'post\' id=\'form1\' name=\'form1\'>") wb.InsertHTML("单文件上传: <input type=\'file\' name=\'up1\' id=\'up1\'><br/><br/>") wb.InsertHTML("多文件上传: <input type=\'file\' name=\'up2\' id=\'up2\' multiple><br/><br/>") wb.InsertHTML("<input Type=\'submit\' name=\'Sumbit\' id=\'Sumbit\' value=\'确定\'>") wb.InsertHTML("</form>") End With End With wb.InsertHTML(div) With wb.AddButtonGroup("form1","btg1",False) .Add("btn1", "确定上传", "button").Attribute= "" \'调用js函数上传 .Add("btn2", "取消上传", "submit").FormAction = "default.htm" \'wb.InsertHTML("<div id=\'someelement\'></div>") End With 运行效果如下: 同时确定按钮 直接关联到确定上传按钮事件上 其中js代码如下: function submitForm(){ show("tst1",2000); if (document.get ElementById("单位名称").value && document.get ElementById("支部名称").value ){ submitA jaxForm(\'form1\',\'afterSubmit\'); } else{ show("toptip1",2000); } } [此贴子已经被作者于2021/1/22 14:10:39编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2021/1/22 14:23:00 -- 贴出完整代码 |
||||
-- 作者:cnsjroom -- 发布时间:2021/1/22 14:41:00 -- 回复:(有点蓝)贴出完整代码 麻烦老师看看 谢谢!
|
||||
-- 作者:有点蓝 -- 发布时间:2021/1/22 14:51:00 -- 如果需要在当前位置插入HTML代码,请使用InsertHTML,语法: InsertHTML(Content) Content: 要插入的内容。 wb.AddTopTips("","toptip1","请输入单位名称和支部名称!") With wb.AddInputGroup("form1","ipg2","文件上传") \'文件上传 With.AddUploader("up1","请选择图片",True) \'True表示允许上传多个文件 .AllowDelete = True \'允许删除 .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 1024 End With Dim sb As New StringBuilder sb.appendLine("<div>") sb.appendLine("单文件上传: <input type=\'file\' name=\'up1\' id=\'up1\'><br/><br/>") sb.appendLine("多文件上传: <input type=\'file\' name=\'up2\' id=\'up2\' multiple><br/><br/>") sb.appendLine("<input Type=\'submit\' name=\'Sumbit\' id=\'Sumbit\' value=\'确定\'>") sb.appendLine("</div>") wb.InsertHTML("form1",sb.ToString) wb.InsertHTML(div) With wb.AddButtonGroup("form1","btg1",False)
|
||||
-- 作者:cnsjroom -- 发布时间:2021/1/22 17:00:00 -- 回复:(有点蓝)如果需要在当前位置插入HTML代码,请... 谢谢老师 Dim sb As New StringBuilder sb.appendLine("<div>") sb.appendLine("单文件上传: <input type=\'file\' name=\'up1\' id=\'up1\'><br/><br/>") sb.appendLine("多文件上传: <input type=\'file\' name=\'up2\' id=\'up2\' multiple><br/><br/>") sb.appendLine("</div>") wb.InsertHTML("form1",sb.ToString) 经过测试单文件上传的时候,文件可以到达数据表中 多文件上传的时候哦 一个文件都没有上传上去 也没有形成数据记录 麻烦老师指导下 谢谢 |
||||
-- 作者:有点蓝 -- 发布时间:2021/1/22 17:18:00 -- 接收文件的代码?http://www.foxtable.com/mobilehelp/topics/0060.htm 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 If key = "up2" Then ……
Next |
||||
-- 作者:cnsjroom -- 发布时间:2021/1/22 19:41:00 -- 回复:(有点蓝)接收文件的代码?http://www.foxtabl... 上传word文件并保存后 想在移动端显示出来 怎么显示word文件呢?直接显示在页面上而不是单独打开! 当前显示页面代码如下: Dim e As RequestEventArgs = args(0) Dim wb As New weui Dim xingming As String = e.PostValues("姓名") Dim danweimingcheng As String = e.PostValues("单位名称") Dim suoshuzhibu As String = e.PostValues("部门名称") Dim huiyibianhao As String = e.PostValues("文件编号") Dim tupianleibie As String = e.PostValues("文件类别") Dim cmd11 As New SQ LCommand cmd11.Connec ti cmd11.Comma ndText="sele ct 文件 from 文件附件 where 文件类别= \'" & tupianleibie & "\'and 文件编号= \'" & huiyibianhao & "\'and 姓名= \'" & xingming & "\'and 单位名称= \'" & danweimingcheng & "\' and 部门名称= \'" & suoshuzhibu & "\'" Dim dt As DataTable = cmd11.ExecuteReader Dim src As String wb.AddPageTitle("","ph1","三会一课系统","专为瓮安检察院党建信息管理设计") wb.AddForm("","form1","getvimg.htm") With wb.AddInputGroup("form1","ipg11","基础资料") .AddInput("单位名称","单位名称","text").value = danweimingcheng .AddInput("部门名称","部门名称","text").value = suoshuzhibu .AddInput("姓名","姓名","text").value = xingming .AddInput("文件编号","文件编号","text").value = huiyibianhao .AddInput("文件类别","文件类别","text").value = tupianleibie End With With wb.AddInputGroup("form1","ipg1111","文件信息") With .AddUploader("up111","",True) .AllowAdd = False \'关闭文件上传功能 For Each dr As DataRow In dt.DataRows Dim imagebytes As Byte() = dr("文件") src = Convert.ToBase64String(imagebytes) .AddImage("data:image/jpeg;base64," & src) Next With wb.AddArticle("","ar1") .UseGallery = True \'启用Gallery,必须放在第一行 End With End With End With With wb.AddInputGroup("form1","ipg33","") With wb.AddButtonGroup("form1","btg1",False) \'垂直排列 .Add("btn1", "继续检索", "submit").FormAction = "test.htm" .Add("btn2", "返回首页", "", "default.htm") End With End With e.WriteString(wb.Build) \'生成网页 |