以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]移动开发多文件上传问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=101993) |
-- 作者:菜鸟王中王 -- 发布时间:2017/6/11 13:10:00 -- [求助]移动开发多文件上传问题 移动开发多文件上传的问题: 我先说一下我的思路 单个文件上传肯定没有问题,但是应为安卓的原因,就算把属性设置为可以多个文件,其实还是只能一个文件上传,并且我发现必须要压缩上传才可以所以代码如下: Dim fl As String = "d:\\web\\" & e.path If filesys.FileExists(fl) Dim idx As Integer = fl.LastIndexOf(".") Dim ext As String = fl.SubString(idx) Select Case ext Case ".jpg",".gif",".png",".bmp",".wmf",".js",".css" ,".html",".htm",".zip",".rar" e.WriteFile(fl) Return \'这里必须返回 End Select End If Select Case e.Path Case "addnew.htm","" Dim wb As New WeUI If e.PostValues.Count = 0 Then wb.AddForm("","form1","receive.htm") With wb.AddInputGroup("form1","ipg1","举报内容") With .AddUploader("up1","照片1",False) .AllowDelete = True .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 800 \'自动压缩图片宽度为400个像素,高度等比例压缩 End With With .AddUploader("up2","照片2",False) .AllowDelete = True .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 800 \'自动压缩图片宽度为400个像素,高度等比例压缩 End With With .AddUploader("up3","照片3",False) .AllowDelete = True .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 800 \'自动压缩图片宽度为400个像素,高度等比例压缩 End With With .AddUploader("up4","照片4",False) .AllowDelete = True .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 800 \'自动压缩图片宽度为400个像素,高度等比例压缩 End With With .AddUploader("up5","照片5",False) .AllowDelete = True .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 800 \'自动压缩图片宽度为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) \'生成网页 End If Case "receive.htm" Dim wb As New WeUI \'保存图片 \'msgbox(e.Files.Keys.count) \'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) \'Dim lst As List(of String) = dr.Lines("照片1") \'获取文件集合 \'lst.Add(fln) \'给集合增加一个文件 \'dr.Lines("照片1") = lst \'将新的集合赋值给文件列 \' \' \'Next \' \' \' \'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 End If If key = "up2" Then For Each fln As String In e.Files(key) e.SaveFile(key, fln, ProjectPath & "Attachments\\" & fln) Next End If If key = "up3" Then For Each fln As String In e.Files(key) e.SaveFile(key, fln, ProjectPath & "Attachments\\" & fln) Next End If If key = "up4" Then For Each fln As String In e.Files(key) e.SaveFile(key, fln, ProjectPath & "Attachments\\" & fln) Next End If If key = "up5" Then For Each fln As String In e.Files(key) e.SaveFile(key, fln, ProjectPath & "Attachments\\" & fln) Next End If Next e.WriteString("OK") End Select 具体要求就是一次性多文件上传,一直不成功,求指教。
|
-- 作者:有点色 -- 发布时间:2017/6/11 14:06:00 -- 第三个参数设置成true,才能选择多个文件的啊
http://www.foxtable.com/mobilehelp/scr/0054.htm
|
-- 作者:菜鸟王中王 -- 发布时间:2017/6/11 20:36:00 -- 上传文件 老是有 “由于线程退出或应用程序请求,已中止 I/O 操作。” 提示 求助 |
-- 作者:有点色 -- 发布时间:2017/6/12 9:19:00 -- 以下是引用菜鸟王中王在2017/6/11 20:36:00的发言:
上传文件 老是有 “由于线程退出或应用程序请求,已中止 I/O 操作。” 提示 求助
做个具体的例子上来测试。 |