Handling Package Upload
Sometimes you may need to know a state or server response for each uploaded package or file (if every file is
uploaded in a separate request). It may be useful to implement the following functionalities:
- Send the next file depending on the upload result of previous ones;
- Save the upload list before sending of each file to provide users with possibility of recovering the upload process
even through Image Uploader was reloaded. Read more about this functionality in the
Restoring Upload Pane Content topic;
- Show uploaded thumbnails to users right after files are saved on a server.
To handle package upload Image Uploader provides the PackageXXX events:
fires when the current package is about to be uploaded;
- PackageComplete(PackageIndex, ResponsePage)
fires when the current package was uploaded successfully;
- PackageError(PackageIndex, ErrorCode, HttpResponseCode, ErrorPage, AdditionalInfo)
fires if some error occurred during the current package upload;
- PackageProgress(PackageIndex, Status, Progress, ValueMax, Value, StatusText)
fires to indicate the progress of the current package upload.
These events can be compared with the similar ones used to handle the whole upload process:
Each pair (BeforeUpload and PackageBeforeUpload,
AfterUpload and PackageComplete,
Error and PackageError,
Progress and PackageProgress) works in
the similar manner with only one difference. PackageXXX events fire for each package inside
the current upload session and provide the additional parameter PackageIndex to determine the index of the current processed package.
By the way, these event pairs can work equally if all the files are sent in the single package (i.e. if the