my code works if i select only one file to upload.
but it will return error if i select more than one files.
Code Behind
Private Sub PopulateUploadedFilesList(ByVal uf As RadAsyncUpload)
Dim filePath As String = System.Configuration.ConfigurationManager.AppSettings("AttachmentPath").ToString()
Dim fileName As String = ""
Dim sessionid As Integer = 0
Dim dc As New dcLRDBDataContext
If Not IsNothing(HttpContext.Current.Session("SessionID")) Then
sessionid = HttpContext.Current.Session("SessionID").ToString
ElseIf Not IsNothing(HttpContext.Current.Session("tmpSID")) Then
sessionid = HttpContext.Current.Session("tmpSID").ToString
Else
Dim rnd As New Random()
Dim tmpSID As Integer 'allow 10 digit only
tmpSID = rnd.Next(1000, 9999) & DateTime.Now.Hour & DateTime.Now.Minute
HttpContext.Current.Session("tmpSID") = tmpSID
sessionid = tmpSID
End If
For Each file As UploadedFile In uf.UploadedFiles
Dim uploadedFileInfo As New UploadedFileInfo(file)
UploadedFiles.Add(uploadedFileInfo)
Dim newRecord1 As New db_Attachment
dc.db_Attachments.InsertOnSubmit(newRecord1)
newRecord1.FileName = sessionid & "_" & file.FileName
newRecord1.FileSize = file.ContentLength / 1024
newRecord1.UploadBy = HttpContext.Current.Session("UserID")
newRecord1.UploadDate = DateTime.Now
newRecord1.LastUpdatedOn = DateTime.Now
newRecord1.LastUpdatedBy = HttpContext.Current.Session("UserID")
dc.SubmitChanges()
file.SaveAs(filePath & sessionid & "_" & file.FileName)
Next
dc.Dispose()
End Sub
it return error when doing th "file.saveAs...." code