Only occasionally I am receiving the "IOException: The process cannot access the file 'file path' because it is being used by another process".
How can I handle my upload to avoid encountering this error?
Here's my code example.
On the webform page.
<telerik:RadAsyncUpload
runat="server"
ID="fileUpload"
ChunkSize="3145728"
MaxFileInputsCount="1"
AllowedFileExtensions=".htm,.html,.HTML,.doc,.DOC,.docx,.zip,.txt,.mht,.MHT,.msg,.mp4,.pdf,.PDF"
OnClientValidationFailed="uploadValidationFailed">
</telerik:RadAsyncUpload>
<telerik:RadProgressArea
runat="server"
ID="RadProgressAreaTechNotes">
</telerik:RadProgressArea>
Codebehind
foreach (UploadedFile file in fileUpload.UploadedFiles)
{
uploadedFilename = file.FileName;
asyFileExtension = file.GetExtension().Replace(".", string.Empty);
asyFileSize = file.ContentLength;
string spath = storePath + uploadedFilename;
file.SaveAs(spath);
}