This event fires when the current package was uploaded successfully.
<script type="text/javascript"> function Uploader1_AfterPackageUpload(packageIndex, response){ //...your code... } </script>
<aur:Uploader ID="Uploader1" runat="server"> <ClientEvents> <aur:ClientEvent EventName="AfterPackageUpload" HandlerName="Uploader1_AfterPackageUpload" /> </ClientEvents> </aur:Uploader>
<script type="text/javascript"> function Uploader1_AfterPackageUpload(packageIndex, response){ //...your code... } </script>
<?php $Uploader = new Uploader("Uploader1"); //...other params... $Uploader->getClientEvents()->setAfterPackageUpload("Uploader1_AfterPackageUpload"); //...other params... $Uploader->render(); ?>
function Uploader1_AfterPackageUpload(packageIndex, response){ //...your code... }
$au.uploader({ events: { //...other params... afterPackageUpload: [Uploader1_AfterPackageUpload], //...other params... } })
Type: Number
The zero-based index of the package inside the current upload session.
Type: String
The HTML code of the page returned from the server-side upload script after processing the current package.
Type: Boolean
If false
, the upload process stops and the Error event is fired with error code 18
.
This event makes sense if the FilesPerPackage property is greater than or equal to 1
; otherwise, this
event works equally to the AfterUpload.
You can use this event to stop the upload if the currently uploaded file fails some server-side verification. To do this, you can use the following algorithm:
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 use the AfterPackageUpload event handler to check this response using the
response parameter. If it equals to "Failed"
the event handler should return false
.
function afterPackageUpload(index, response){ if (response.substring(0, 6) == "Failed") return false; else return true; }
18
.