OnFileUploaded

Last post 03-28-2011, 10:02 AM by Eric. 1 replies.
Sort Posts: Previous Next
  •  03-27-2011, 4:05 AM 66872

    OnFileUploaded

    Hi,

    I use OnFileUploaded event to copy the files from temp folder to another place on the disk.
    I also make some other processes such as generating thumbnails and updating the database.

    I know that OnFileUploaded event runs once for each file uploaded.

    But I see that OnFileUploaded event runs for each file uploaded after all the files are uploaded.

    When the number of files uploaded is high it takes a lot of time for OnFileUploaded event to run for each file uploaded. The users sometimes think that the web site freezed.

    Is there a solution for this?

    Regards,
    Ata

    fotoğraf baskı
  •  03-28-2011, 10:02 AM 66894 in reply to 66872

    Re: OnFileUploaded

    Dear giray,
     
    Please use MoveTo to handle the uploaded files, you can change:
     
     void Uploader_FileUploaded(object sender, UploaderEventArgs args)
      {
             InsertMsg("File uploaded! " + args.FileName + ", " + args.FileSize + " bytes.");
            //Copys the uploaded file to a new location.
            args.CopyTo("c:\\temp\\"+args.FileName);
            //You can also open the uploaded file's data stream.
            //System.IO.Stream data = args.OpenStream();
      }
    to
     
    void Uploader_FileUploaded(object sender, UploaderEventArgs args)
    {
    InsertMsg("File uploaded! " + args.FileName + ", " + args.FileSize + " bytes.");
    //Copys the uploaded file to a new location.
    args.MoveTo("c:\\temp\\"+args.FileName);
    //You can also open the uploaded file's data stream.
    //System.IO.Stream data = args.OpenStream();
    }
     
    Thank you for asking
View as RSS news feed in XML