## Aurigma Image Uploader 6.1 Dual

# ImageUploader.PackageComplete Event

- Collapse All Sections
- See Also
- Language Filter ( all languages )
- Supported in: ActiveX , Java

Raised when the current package was uploaded successfully.

## Syntax

### JavaScript

    <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>

### Parameters

PackageIndex

  Zero-based index of the package (i.e. request) inside the current upload session.

ResponsePage

  The page returned from the server.

## Remarks

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:

1. Configure Image Uploader to send every file in a separate package, i.e. set the FilesPerOnePackageCount property to 1.

2. 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.

   ### C#

       <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>

3. 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.

   ### C#

       function ImageUploader_PackageComplete(PackageIndex, ResponsePage)
       {
           if (ResponsePage.substring(0, 6) == "Failed")
               return false;
           else
               return true;
       }

4. Right now the upload process stops and the PackageError and Error events are fired with error code 18.

## See Also

### Reference

- FilesPerOnePackageCount Property
- Error Event
- PackageBeforeUpload Event
- PackageProgress Event
- PackageError Event