Raised when the current package was uploaded successfully.
<script type="text/javascript" src="iuembed.js"> </script> <script type="text/javascript"> function ImageUploaderID_PackageComplete(PackageIndex, ResponsePage) { //...your code... } var iu = new ImageUploaderWriter("ImageUploaderID", 610, 500); //...params... //...other event listeners... iu.addEventListener("PackageComplete", "ImageUploaderID_PackageComplete"); //...other event listeners... iu.writeHtml(); </script>
Zero-based index of the package (i.e. request) inside the current upload session.
The page returned from the server.
A boolean value (true
or false
). If event handler returns false
, the upload process stops and the
PackageError and Error events are fired with error code 18
.
You can use this event to stop the upload if the currently uploaded file fails some server-side verification. To do it you can use the following algorithm:
Configure Image Uploader to send every file in a separate package, i.e. set the FilesPerOnePackageCount property to 1
.
Write your server-side upload script. It should apply some verification to the uploaded file and put the corresponded
string value to the response. For example, "Success"
if the file meets verification conditions or "Failed"
if does not.
<script runat="server"> void Page_Load() { if (Request.Files.Count == 0) return; if (VerifyFile(Request.Files[0])) Response.Write("Success"); else Response.Write("Failed"); } </script>
Then in the PackageComplete event handler you can check this response using the
ResponsePage parameter. If it equals to "Failed"
the event handler should return false
.
function ImageUploader_PackageComplete(PackageIndex, ResponsePage) { if (ResponsePage.substring(0, 6) == "Failed") return false; else return true; }
Right now the upload process stops and the PackageError and
Error events are fired with error code 18
.