我把每个照片的路径作为一条记录,放在C_SI_Estimate_DTL_FILES表中
显示如下:
Dim sdr As DataRow = DataTables("C_SI_Estimate_DTL_FILES").SQLFind("DTL_id = '" & xdr("DTL_id") & "' and IS_ACTIVE ='1' ")
With .AddUploader("up1","照片",True) 'True表示允许上传多个文件
.ScaleWidth= 800
If sdr IsNot Nothing Then
For Each dr As DataRow In DataTables("C_SI_Estimate_DTL_FILES").SQLSelect("DTL_id = '" & xdr("DTL_id") & "' and is_active='1' ")
.AddImage( "./upload/" & dr("FILES_SAVENAME") )
Next
End If
End With
保存附件如下:
'保存附件
For Each key As String In e.Files.Keys
If key = "up1" Then
For Each fln As String In e.Files(key)
Dim s As String=fln
s=s.substring(s.LastIndexOf("."))
Dim s2 As String =Guid.NewGuid().ToString().replace("-","")
s= s2 & s
e.SaveFile(key, fln, ProjectPath & "web\upload\" & s)
Dim dr2 As DataRow = DataTables("C_SI_Estimate_DTL_FILES").SQLAddNew()
dr2("FILES_SAVENAME") = s
dr2("FILES_NAME") = fln
dr2("DTL_id")=Dtlid
dr2("CREATE_TIME")=now.Tostring.replace("-","").replace(" ","").replace(":","")
dr2("UPDATE_TIME")=now.Tostring.replace("-","").replace(" ","").replace(":","")
dr2("IS_ACTIVE")="1"
If openid>"" Then
dr2("creator")=fdp("person_id")
Else
dr2("creator")="test"
End If
dr2.save()
Next
End If
Next