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

The process cannot access the file 'path' because it is being used by another process.

1 Answer 402 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Elton
Top achievements
Rank 1
Elton asked on 21 Apr 2008, 05:33 AM
Hello Telerik,
I got this error after I try to use upload control a couple of times. I know it's caused by the stream's not disposed but I think I did that already...
Here is my code:

...  
            foreach (UploadedFile file in FileUpload.UploadedFiles)  
            {  
                file.SaveAs();                             
            }  
...  
 
            foreach (UploadedFile file in FileUpload.UploadedFiles)  
            {  
                file.InputStream.Close();  
                file.InputStream.Dispose();                 
            } 

still get the error, any idea?

Cheers,
Elton

1 Answer, 1 is accepted

Sort by
0
Sophy
Telerik team
answered on 22 Apr 2008, 01:19 PM
Hi Elton,

RadUpload does not lock the saved with the SaveAs method or the accessed with the InputStream property files. The files are automatically closed by the RadUpload control. You can take a look at this help article for more information about manipulating the uploaded files and some sample code snippets.

Probably there is some other process in your case which locks the uploaded files after they are saved. From the provided code snippet I am not able to find which is the process which causes the problem. You should research and find what locks the uploaded files in order to prevent this happening.

If the suggested above cannot help you solve the problem, please, send us a simple running application which reproduces the issue so that we can take a closer look at your scenario.
You will need to open a support ticket in order to have the right to attach files. Please, download a trial version of the RadControls for ASP.NET AJAX suite and you will have the right to open a support ticket. For your convenience I have attached a screenshot with instructions how to open a support ticket.

Best wishes,

Sophy
the Telerik team


Instantly find answers to your questions at the new Telerik Support Center
Tags
Upload (Obsolete)
Asked by
Elton
Top achievements
Rank 1
Answers by
Sophy
Telerik team
Share this question
or