5.16.2

Uploading Files

Assuming you already have a copy of Fine Uploader, first and foremost, you are going to want to make sure you've read the Getting Started guide.

If you feel comfortable from there, we can begin explaining how Fine Uploader uploads files, as well as some of the basic options one can set to customize their uploads.

Note

Before you delve any further, note that this section assumes you have a (working!) server to handle uploads. If not, then make sure to check out the server-side guidelines for either traditional or Amazon S3 upload endpoints.

Successfully Uploading

Upload success will occur when the server's response status is 200-204 and the request body is a JSON string { "success": "true" }

Auto/Manual Uploading

Fine Uploader can automatically upload files that are added to it, or wait until the user triggers an action to upload. Automatic uploads are turned on or off via the autoUpload property of the main options object.

By default autoUpload is enabled.

// Upload automatically
var uploader = new qq.FineUploader({
    /* other required config options left out for brevity */

    request: {
        endpoint: '/server/upload'
    }
});

If autoUpload is set to false, then items added to Fine Uploader will be queued until you explicitly trigger the uploads via the API time. Uploads can be triggered by calling the uploadStoredFiles method on an instance of Fine Uploader.

// Manually upload
var uploader = new qq.FineUploader({
    /* other required config options left out for brevity */

    autoUpload: false,
    request: {
        endpoint: '/server/upload'
    }
});

qq(document.getElementById("upload-button")).attach('click', function() {
    uploader.uploadStoredFiles();
});