以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于upload  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=103066)

--  作者:客家阿哥
--  发布时间:2017/6/30 0:01:00
--  关于upload

接收上传的文件

假定有下图所示的一个表:

图片点击可在新窗口打开查看

希望设计一个下图所示的录入界面,能拍照并上传照片:

图片点击可在新窗口打开查看

HttpRequest事件代码:

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
Dim
 wb As New weui
Select
 Case e.Path
    Case "addnew.htm"
        If e.PostValues.Count = 0 Then
            wb.AddForm("","form1","addnew.htm")
            With wb.AddInputGroup("form1","ipg1","
增加员工")
                .AddInput("
姓名","姓名","Text"\'前一个"姓名"ID,后一个"姓名"是标题
                .AddInput("
年龄","年龄","number")
                .AddSelect("
学历","学历","大专|本科|硕士|博士")
                .AddUploader("up1","
照片",True\'True表示允许上传多个文件
            End With


            With wb.AddButtonGroup("form1","btg1",True)
                .Add("btn1""
确定""submit")
            End 
With


            e.WriteString(wb.Build)
        Else
            Dim nms() As 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 & "Attachments\\" & fln)
                    Next
                    dr.Lines("
照片") = e.Files(key)
                End If
            Next
            \'
保存并生成增加成功提示页面
            dr.save()
            With wb.AddMsgPage("","msgpage","
增加成功""好好学习,天天向上"\'生成成功提示页
                
.AddButton("btn1","继续增加","addnew.htm")
            End With
            e.WriteString(wb.Build)
        End If

End
 Select


================================================================

加粗的按钮代码,改成增强型uplaod的代码怎么改?



        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1""
确定""button").Attribute= "" \'调用js函数上传
        End With


--  作者:有点蓝
--  发布时间:2017/6/30 9:05:00
--  
按帮助用法:http://www.foxtable.com/mobilehelp/scr/0106.htm

wb.AddForm("","form1","addnew.htm")
With wb.AddInputGroup("form1","ipg1","增加员工")
    .AddInput("姓名","姓名","Text") \'前一个"姓名"是ID,后一个"姓名"是标题
    .AddInput("年龄","年龄","number")
    .AddSelect("学历","学历","大专|本科|硕士|博士")
    With .AddUploader("up1","照片",True)
        .AllowDelete = True \'允许删除
        .Incremental = True \'允许 重复选择文件或连续拍照
    End With
End With

With wb.AddButtonGroup("form1","btg1",True)
    .Add("btn1", "确定", "button").Attribute= "onclick=\'submitForm()\'" 
End With
[此贴子已经被作者于2017/6/30 9:05:02编辑过]