This is a migrated thread and some comments may be shown as answers.

The process cannot access the file because it is being used by another process. telerik rad file upload

1 Answer 218 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Divya
Top achievements
Rank 1
Divya asked on 23 Jan 2013, 10:47 AM
I am using telerik:RadAsyncUpload ,in upload button click in this line

 file.SaveAs("D:\\Uploaded_Files\\" + newName + file.GetExtension());
Im getting the error "The process cannot access the file because it is being used by another process. telerik rad file upload"
Please help me.
protected void btn_Upload_Click(object sender, EventArgs e)
        {
            foreach (UploadedFile file in RadAsyncUpload_Lead_File.UploadedFiles)
            {
                byte[] bytes = new byte[file.ContentLength];
                file.InputStream.Read(bytes, 0, file.ContentLength);
                string name = file.GetName();
                RadAsyncUpload_Lead_File.TargetFolder = @"D:\Uploaded_Files\";
                string newName = "newName";
                file.SaveAs("D:\\Uploaded_Files\\" + newName + file.GetExtension());
                
                //files.Add(file);
            }
        }

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 28 Jan 2013, 08:13 AM
Hi,

 
I will recommend you to use onFileUploaded event of RadAsyncUpload to save the files to the desired folder.

Hope this will be helpful.

All the best,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
AsyncUpload
Asked by
Divya
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or