需要接收页面上传的文件,代码缩减如下。不知道那里出问题了,用 submit 提交数据时接收不到任何文件。
Dim wb As New WeUI
If e.PostValues.Count = 0 Then
'请假单查询
wb.AddForm("", "form1", "test.htm")
'显示审批意见或输入框
With wb.AddInputGroup("form1", "bzr", "班主任意见")
.AddTextArea("bzryj", 3).Placeholder = "请输入具体内容"
With .AddUploader("zz", "家校沟通佐证", True)
.AllowDelete = True '允许删除
.Incremental = True '允许重复选择文件或连续拍照
.ScaleWidth = 800 '自动压缩图片宽度为400个像素,高度等比例压缩
End With
End With
With wb.AddButtonGroup("form1", "btg1", False) '水平排列
With .Add("btn1", "驳回", "submit")
.Kind = 2
.Value = "btn1"
End With
With .Add("btn2", "同意", "submit")
.Value = "btn2"
' .Attribute = "" '调用js函数上传
End With
End With
Else
'接收审批意见及附件
Dim dr As DataRow
Dim yj As String
'判断是否同意
If e.PostValues.ContainsKey("btn1") Then
yj = "【驳回】"
ElseIf e.PostValues.ContainsKey("btn2") Then
yj = "【同意】"
End If
'保存附件
For Each key As String In e.Files.Keys
Dim i As Integer = 0
Dim flns As New List(Of String)
For Each fln As String In e.Files(key)
Dim fext As String
fext = fln.LastIndexOf(".")
fext = fln.SubString(fext) '获取扩展名
i = i + 1
flns.Add( dr("请假单号") & "_gt" & i & fext)
e.SaveFile(key, fln, ProjectPath & "web\uploadfiles\" & "_gt" & i & fext) '保存接收到的文件
Next
Next
End If
e.WriteString(wb.Build) '生成网页