网页提交数据截图如下:
此主题相关图片如下:网页显示.png
Case "uploadpic.htm"
Dim wb As New weui
If e.PostValues.Count = 0 Then
wb.AddForm("", "form1", "accept.htm")
With wb.AddInputGroup("form1", "ipg22", "文件上传") '带图片浏览的文件上传
With .AddUploader("up2", "图片", True) 'True表示允许一次上传多个文件
.AddImage("./images/001.jpg")
.AddImage("./images/002.jpg")
End With
End With
With wb.AddButtonGroup("form1", "btg2", True)
.Add("btn1", "ajax上传", "button").Attribute = "" '调用js函数上传
End With
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
e.WriteString(wb.Build)
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) '保存接收到的文件
Next
Next
e.WriteString(wb.Build)
End If
Case "accept.htm"
Dim sb As New StringBuilder
For Each key As String In e.Files.Keys
sb.AppendLine(key & " 上传" & e.Files(key).Count & "个文件,分别是:</br>")
For Each fle As String In e.Files(key)
sb.AppendLine(fle & "<br>")
e.SaveFile(key, fle, "d:\web\uploadfiles\" & fle) '保存接收到的文件
Next
sb.AppendLine("</br>")
Next
sb.AppendLine("接收到的数据有:<br/><br/>")
For Each key As String In e.Values.Keys
sb.AppendLine(key & ":" & e.Values(key) & "<br/>")
Next
sb.AppendLine("</br>")
sb.AppendLine("以上文件服务器已正确接收并保存!")
e.WriteString(sb.ToString)