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

  •  06-24-2009, 10:51 AM

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

    I'm uploading the files using the ajax uploader.  Elsewhere in my code (on another page), I'm attempting to move the files (using File.Move) that have been uploaded to another directory.  This won't happen until a certain amount of time has passed.  Only after this time can I move the files (as of right now, I've waited 25 mins and I still can't move the files, but the files will eventually move)
     
    Here is how I have the uploader set up:
    <CuteWebUI:Uploader runat="server" ID="up1" InsertButtonID="upBtn" MultipleFilesUpload="true"
    EnableViewState="false" onfileuploaded="up1_FileUploaded"
    AutoUseSystemTempFolder="false" onuploadcompleted="up1_UploadCompleted"></CuteWebUI:Uploader>

    protected void up1_FileUploaded(object sender, CuteWebUI.UploaderEventArgs args)
    {
    Uploader uploader = (Uploader)sender;
    string path = Server.MapPath("~/uploads");

    if (File.Exists(path + "\\\\" + filename))
    {
    //rename the file

    filename = Images.RenameFile(path, filename);
    args.CopyTo(path +
    "\\\\" + filename);
    }
    else
    {
    args.CopyTo(path + "\\\\" + filename);
    }
    }

    In the up1_UploadCompleted, all I do is take the filenames that were uploaded and put them into a database.
     
    So...what's the deal?
View Complete Thread