以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  多文件上传问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=183171)

--  作者:YDS
--  发布时间:2022/10/27 7:59:00
--  多文件上传问题
‘新建工单的代码
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
If e.Values.Count = 0 Then
    wb.Title = "新建工单"
    wb.AddForm("", "form1", "addnew.htm")
    With wb.AddInputGroup("form1", "ipg1", "产品信息")
        .AddInput("产品类型", "产品类型", "Text")
        .AddInput("产品型号", "产品型号", "Text")
        .AddInput("产品编号", "产品编号", "Text")
    End With
    With wb.AddInputGroup("form1", "ipg2", "问题描述")
        .AddTextArea("问题描述", 8)
    End With
    With wb.AddInputGroup("form1", "ipg3", "上传图片")
        With .AddUploader("up1", "图片", True)
            .TextPosition = 0 \'标题靠左
            .Accept = "image/*" \'允许使用相册和相机 
            .AllowDelete = True \'允许删除
            .Incremental = True \'允许重复选择图片或连续拍照            
        End With
    End With
    With wb.AddInputGroup("form1", "ipg4", "上传文件")
        With .AddUploader("up2", "文件", True) \'True表示允许上传多个文件
            .TextPosition = 0 \'标题靠左
            \'           .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)
Else
    Dim OpenID As String = Functions.Execute("GetOpenID", e)
    Dim nms() As String = {"产品类型", "产品型号", "产品编号", "问题描述"}
    Dim dr As DataRow = DataTables("工单").AddNew()
    For Each nm As String In nms
        If e.Values.ContainsKey(nm) Then
            dr(nm) = e.Values(nm)
        End If 
    Next
    dr("openid") = OpenID
    dr("提交时间") = Date.Now
    dr("ID") = Date.Now.ToString("yyyyMMddHHmmssfff")
    dr("状态") = "已提交"
    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\\img\\" & dr("ID") & "\\" & fln)
            Next
            dr.Lines("图片") = e.Files(key)
        ElseIf key = "up2" Then
            For Each fln As String In e.Files(key)
                e.SaveFile(key, fln, ProjectPath & "Attachments\\file\\" & dr("ID") & "\\" & fln)
            Next
            dr.Lines("文件") = e.Files(key)
        End If
    Next
    \'保存并生成增加成功提示页面
    dr.save()
    e.WriteString("OK")
End If

上传图片没有问题,为什么上传文件选择好文件以后不会显示,但是可以正常上传

--  作者:有点蓝
--  发布时间:2022/10/27 8:44:00
--  
本来就是这样的,除了图片,其它文件都不会显示
--  作者:YDS
--  发布时间:2022/10/27 9:46:00
--  
有没有办法显示一下
--  作者:有点蓝
--  发布时间:2022/10/27 9:49:00
--  
weui没有办法。