Uploading multiple files in relation to OnFileUploaded, OnUploadCompleted, etc.

Last post 10-21-2011, 7:53 AM by MarjaR. 5 replies.
Sort Posts: Previous Next
  •  09-01-2011, 8:09 AM 69910

    Uploading multiple files in relation to OnFileUploaded, OnUploadCompleted, etc.

    From the documentation, I understand that OnFileUploaded should fire after each single file upload, whereas OnUploadCompleted should fire after all selected files are uploaded.
     
    I'm using the OnFileUploaded event, because I want to handle each separate uploaded file immediately (eg. resize uploaded image). But the event turns out to fire after all files are uploaded to the temporary location, instead of after each single file.
     
    That means that when I'm uploading a selection of eg. 200 images to the server, and resizing them after upload, there are 200 original size persisted image files in the temporary directory. And that sometimes causes a 'disk full' message, while it would fit just fine on disk once they are resized.
     
    What do I need to do to be able to resize an uploaded image and get rid of its temporary persisted version, before the Uploader proceeds to uploading the next selected file?

    Regards, Marja
  •  10-19-2011, 11:43 AM 70477 in reply to 69910

    Re: Uploading multiple files in relation to OnFileUploaded, OnUploadCompleted, etc.

    Anyone?
    Regards, Marja
  •  10-20-2011, 10:35 AM 70490 in reply to 70477

    Re: Uploading multiple files in relation to OnFileUploaded, OnUploadCompleted, etc.

    Hi MarjaR,
     
    Please try the example below, it will delete the temp file one bye one when the file upload finished.
     
    <%@ Page Language="C#" Title="Customize the queue UI" %>

    <%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

    <script runat="server">

        protected void uploader1_FileValidating(object sender, UploaderEventArgs args)
        {
            //handle the upload files
            args.CopyTo("~/Uploads/" + args.FileName);
            //delete the temp file
            args.Delete();
        }
    </script>

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
    </head>
    <body>
        <form id="Form1" runat="server">
            <CuteWebUI:UploadAttachments ID="uploader1" runat="server" OnFileValidating="uploader1_FileValidating">
            </CuteWebUI:UploadAttachments>
        </form>
    </body>
    </html>
     
    Regards,
     
    Ken
  •  10-20-2011, 12:34 PM 70493 in reply to 70490

    Re: Uploading multiple files in relation to OnFileUploaded, OnUploadCompleted, etc.

    Okay, but then what exactly is the difference between OnFileUploaded and OnUploadCompleted? 
    Regards, Marja
  •  10-21-2011, 7:38 AM 70500 in reply to 70493

    Re: Uploading multiple files in relation to OnFileUploaded, OnUploadCompleted, etc.

    Hi MarjaR,
     
    If you upload 10 files, the OnFileUploaded will fire 10 times, OnUploadCompleted will fire one time.
     
    Regards,
     
    Ken
  •  10-21-2011, 7:53 AM 70502 in reply to 70500

    Re: Uploading multiple files in relation to OnFileUploaded, OnUploadCompleted, etc.

    Kenneth:
    If you upload 10 files, the OnFileUploaded will fire 10 times, OnUploadCompleted will fire one time.
    Okay, but both are supposed to fire only after all uploads have completed? If so, that might be something to mention explicitly in the documentation. 

    Regards, Marja
View as RSS news feed in XML