- Upload Suite Overview
- What's New?
- Choosing Upload Technology
- Evaluating Upload Suite
- Upload Suite Editions
- System Requirements
- Installation and Deployment Notes
- ActiveX/Java Uploader
- Where ActiveX/Java Uploader Can Be Useful
- Before You Started with ActiveX/Java Uploader
- ActiveX/Java Uploader Fundamentals
- ActiveX/Java Uploader User Interface
- Getting Started
- Using ActiveX/Java Uploader
- Uploading in ASP.NET
- Uploading in PHP
- Uploading in Other Platforms
- Configuring and Handling Upload on Client Side
- Configuring Common Upload Settings in ActiveX/Java Uploader
- Configuring Files to be Uploaded in ActiveX/Java Uploader
- Upload Modes Best Practices
- Sending All Files at Once or in Several Parts in ActiveX/Java Uploader
- Configuring Fail-safe Upload
- Configuring POST Format
- Handling Upload Completion
- Adding Authentication
- Uploading to Amazon S3 Cloud Storages
- Uploading Images
- Customizing User Interface
- Configuring Restriction Rules for Files
- Using ActiveX/Java Uploader at Runtime
- Troubleshooting
- Reference
- HTML5/Flash Uploader
- Licensing Information
- Legal Notices
Handling Upload Completion
When users upload files using a standard <input type="file"> element, they expect to be redirected
to the page to which they have submitted files. However, ActiveX/Java Uploader works differently. The
response generated by the page, which is specified with the UploadSettings.ActionUrl
property, is sent back to ActiveX/Java Uploader and not to the browser. In other words, it works as
follows:
- ActiveX/Java Uploader submits files to the server using POST requests.
- The server script specified with the ActionUrl property processes uploaded files and sends some HTML back to ActiveX/Java Uploader.
- As soon as ActiveX/Java Uploader receives the response, the upload is considered completed. Now, the response should be somehow handled.
What will happen on the last step depends on the settings. By default, no action would be carried out. This is convenient when ActiveX/Java Uploader is inserted into a pop-up window and you would like it to open in the background.
Another popular behavior is to redirect a user to another page which, for example, displays uploaded files. The simplest way to accomplish this is to use the UploadSettings.RedirectUrl property:
<aur:Uploader ID="Uploader1" runat="server">
<UploadSettings ActionUrl="upload.aspx"
RedirectUrl="gallery.aspx" />
</aur:Uploader>$uploader = new Uploader("Uploader1");
$uploader->getUploadSettings()->setActionUrl("upload.php");
$uploader->getUploadSettings()->setRedirectUrl("gallery.php");var u = $au.uploader({
id: 'Uploader1',
uploadSettings: { actionUrl: 'upload.aspx', redirectUrl: 'gallery.aspx' }
});A more complicated but more flexible way of handling the server response is to use the AfterUpload event. It is raised upon successful upload, and using it you can perform any actions allowed in client-side scripting. For instance, you can specify another way of redirecting a user:
function afterUploadHandler(response) {
window.location = "gallery.aspx";
}
var u = $au.uploader({
id: 'Uploader1',
events: { afterUpload: afterUploadHandler }
});You can also get access to the server response returned from the upload processing script. Here we demonstrate how to display a page returned from a server:
function afterUploadHandler(response) {
var newWindow = window.open();
with (newWindow.document) {
open("text/html");
write(response);
close();
}
}
var u = $au.uploader({
id: 'Uploader1',
events: { afterUpload: afterUploadHandler }
});