请教老师,下面的代码,有两个问题,不知问题再哪里,请老师帮忙看看。
1:无法把拍照的图片存放在指定的路径文件夹中,
2:增加行后,表格中的相关文字列有数据,表格中的图片列也没有数据
想实现的是:通过手机进行报修并调用手机中的相机拍照上传几张图片到服务器上的某个文件夹中
Dim wb As New weui
Select Case e.Path
Case "addnew.htm",""
wb.AddPageTitle("","pageheader","AAA","故障报修")
If e.PostValues.Count = 0 Then
wb.AddForm("","form1","addnew.htm")
With wb.AddInputGroup("form1","ipg1","请您填写相关报修信息, 谢谢!")
.AddInput("单位名称","单位名称","text").Placeholder = "请输入单位名称"
.AddInput("报障姓名","姓名","text").Placeholder = "请输入姓名"
.AddInput("联系电话","联系手机","number").Placeholder = "请输入手机号码"
With wb.AddInputGroup("form1","ipg2","故障描述")
.AddTextArea("故障描述",6).Placeholder = "请输入200字以内的描述"
End With
'--------直接拍照上传
With wb.AddInputGroup("form1","ipg3","请拍照上传故障图片")
With .AddUploader("up1","故障图片",True)
.Accept = "image/*"
.AllowDelete = True '允许删除
.Incremental = True '允许重复选择文件或连续拍照
.Capture = "camera" '只能拍照上传
End With
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "提交", "submit") '.Attribute= "" '调用js函数上传
End With
wb.AddToast("","tst1", "正在上传",1)
wb.AddToast("","tst2", "上传成功",0)
wb.AddToast("","tst3", "上传失败",0).Icon= "warn"
wb.AppendHTML("<script src='./lib/ajaxform.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
Else
Dim nms() As String = {"单位名称","报障姓名","联系电话","故障描述"} '不能为空的列名数组
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) = False Then '生成错误提示页
With wb.AddMsgPage("","msgpage","提交失败", nm & "不能为空!")
.icon = "Warn" '改变图标
.AddButton("btn1","返回").Attribute = ""
End With
e.WriteString(wb.Build)
Return '必须返回
End If
Next
nms = New String() {"单位名称","报障姓名","联系电话","故障描述"}
Dim dr As DataRow = DataTables("客户报修").AddNew()
For Each nm As String In nms
If e.PostValues.ContainsKey(nm) Then
dr(nm) = e.PostValues(nm)
End If
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)
e.SaveFile(key,fln,"f:\web\uploadfiles\" & fln) '保存接收到的文件
Next
dr.Lines("故障图片") = e.Files(key)
End If
Next
dr.save()
With wb.AddMsgPage("","msgpage","提交成功", "非常抱歉,给您带来不便!我们将尽快处理,并及时反馈!") '生成成功提示页
.AddButton("btn1","结束退出","https://www.baidu.com/")
End With
e.WriteString(wb.Build)
End If
End Select