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

2 posts, 0 answers
  1. Divya
    Divya avatar
    2 posts
    Member since:
    Jan 2013

    Posted 23 Jan 2013 Link to this post

    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);
                }
            }
  2. Plamen
    Admin
    Plamen avatar
    2729 posts

    Posted 28 Jan 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top