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

Thread is closed for posting
2 posts, 0 answers
  1. Elton
    Elton avatar
    98 posts
    Member since:
    Oct 2007

    Posted 21 Apr 2008 Link to this post

    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
  2. Sophy
    Admin
    Sophy avatar
    636 posts

    Posted 22 Apr 2008 Link to this post

    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
Back to Top