老师,请教两个问题“”
1、下面的码执行时提示 上传失败 但文件夹和表里都有文件了,不过没有压缩。不知问题出在哪里?谢谢!
2、上传成功后在该页面刷新又会增加一行,如何避免?谢谢!
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("学历","学历","大专|本科|硕士|博士")
With .AddUploader("zp","照片",True)
.AllowDelete = True '允许删除
.Incremental = True '允许重复选择文件或连续拍照
.ScaleWidth = 400 '自动压缩图片宽度为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/scystp.js'></script>") '引入脚本文件
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 = "zp" Then
For Each fln As String In e.Files(key)
e.SaveFile(key, fln, "D:\web\Image\" & 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
[此贴子已经被作者于2017/4/9 13:21:08编辑过]