4.4.0

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.

Note

addFiles accepts Files, input elements, or a collection of any of these types provdided the collection object contains an (integer) index property for each contained item.

BlobData objects

BlobData objects are just Blobs with names. Their properties:

var blobData = {
    name: /* Blob name goes here */
    blob: /* Blob goes here */
}

Successfully Uploading

Upload success will occur when the server’s response status is 200 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
$("#fine-uploader").fineUploader({
    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
$("#fine-uploader").fineUploader({
    autoUpload: false,
    request: {
        endpoint: '/server/upload'
    }
});

$("#upload-button").on('click', function () {
    $("#fine-uploader").fineUploader('uploadStoredFiles');
});

Note

jQuery 1.7+ is required to use the on function.