Good Day
i am using a AsyncUpload(telerik), i am in a point where i am supposed to save the File to a certain Folder.
First i check if the directory exist
Because i am doing multiple Upload , i will have to loop through the items of the Upload control and save to a folder.Code:Dim baseDire As String = Server.MapPath("~/MyFILES/") If IO.Directory.Exists(baseDire & Request("Req_ID").ToString()) = False Then IO.Directory.CreateDirectory(baseDire & Request("Req_ID").ToString()) End If
Now when ever i debug this , when it comes to this lineCode:For Each file As UploadedFile In UploadPropDoc.UploadedFiles Dim bytes(file.ContentLength - 1) As Byte file.InputStream.Read(bytes, 0, file.ContentLength) 'Save the File to the disk file.SaveAs(baseDire + file.GetName()) Next
i get an ErrorCode:file.SaveAs(baseDire + file.GetName())
The process cannot access the file because it is being used by another process.
I have removed the Readonly in the Folder that it supposed to write to and gave everyone permission , but still the error persist.
Thanks


Reply With Quote

