请问老师,总是上传失败,请老师修改。对上传多张照片还是搞不懂。
Case "addsjjl.htm"
Dim dr As DataRow = DataTables("送教记录").AddNew()
If e.PostValues.Count = 0 Then
If e.PostValues.Count = 0 Then
wb.AddForm("","form1","addnew.htm")
With wb.AddInputGroup("form1","ipg1","送教信息")
.AddSelect("学生姓名","学生姓名","|靳晓飞|鲁宁|王瑞玉|康龙|马瑞|耿佳乐|潘慧|黄哲|冯婷婷|田彦学|白明花|白振辉|俞鑫") '前一个"姓名"是ID,后一个"姓名"是标题
.AddInput("送教日期","送教日期","date")
.AddInput("送教地点","送教地点","text")
.AddInput("送教内容","送教内容","text")
.AddInput("送教人","送教人","text")
End With
With wb.AddInputGroup("form1","ipg21","送教资料")
With .AddUploader("up1","资料",True) 'True表示可上传多个文件
.Accept = "image/*" '允许使用相册和相机
.AllowDelete = True '允许删除
.Incremental = True '允许重复选择文件或连续拍照
For Each s1 As String In dr.Lines("资料")
.AddImage("./学校档案/送教记录/" & s1)
Next
End With
End With
With wb.AddDialog("","dlg2", "增加成功","谢谢您!")
.AddButton("btn1","返回主菜单","default.htm")
End With
wb.AddToast("","tst1", "正在上传",1)
wb.AddToast("","tst3", "上传失败",0).Icon= "warn"
With wb.AddButtonGroup("form1","btg1",False)
.Add("btn1", "确定", "button").Attribute= ""
.Add("btn2", "放弃", "button", "default.htm").Kind = 2
End With
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
Else
With wb.AddMsgPage("","msgpage","增加失败", "此信息可能已经被删除!") '提示
.icon= "Warn"
' .AddButton("btn1","返回",PageURL) '生成返回原来页面的按钮
End With
End If
e.WriteString(wb.Build)
Else '保存编辑结果
If dr IsNot Nothing Then
Dim nms() As String = {"学生姓名","送教日期","送教时间","送教地点","送教内容","送教人"}
For Each nm As String In nms
dr(nm) = e.PostValues(nm)
Next
Dim lst As List(of String) = dr.Lines("资料")
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,"D:\xxsjk(学校数据库)\web\学校档案\送教记录\" & fln)'ftp和web尽量共用一个图片目录,否则页面无法正常显示图片
lst.Add(fln)
Next
End If
Next
dr.Lines("资料") = lst ''' '保存并生成增加成功提示页面
dr.save()
End If
e.WriteString("OK")
End If
[此贴子已经被作者于2020/4/18 16:15:38编辑过]