- Creating a new file instance
- Wait until a file is available
- Checking the progress of a file upload
- Cancelling a file upload
- Object overview,
- Object overview,
A new file instance can be constructed by calling the
fileFrom function. Where
the first argument is one of the predefined identifiers, and the second argument
holds a file source. Depending on the passed identifier, the function can start
a new upload or return an instance of an existing file.
Note, you can also pass a
settings object to
fileFrom as its third parameter.
Uploading a file from URL is done by passing the
url identifier to the
native file objects. This is done by passing the
object identifier to the
This method supports large file uploads (> 100MB) and checking upload progress. However, it will not work in outdated browsers, see browser support.
You can also upload files from input DOM elements. This is done by passing the
input identifier to
fileFrom. Uploading from such inputs works in all browsers
but does not support large files and checking upload progress.
That is the case when a file instance is created from an existing file that has
a UUID and hence a CDN URL. Any of those can be used as a file source in
fileFrom. The proper identifier to pass to the function, here, is
Quite often, you want to ensure a file is there and ready before getting its instance. That is what the function is all about. It returns a fileInfo object.
error argument in the
fail callback is one of the following values,
or a user-defined custom value, raised via validators.
'baddata', invalid argument passed to file constructor
'size', file size is too large
'upload', error during upload
'user', upload was canceled
'info', error when fetching file information
'deleted', file was deleted, also applicable to groups and files within
When handling larger files, there is a sense in checking their upload progress.
progress function does exactly that and returns an
You can also show a file uploading progress via a jQuery UI progressbar.
cancel in case you want to immediately stop any in-progress upload and
all the events.
Here is how a
fileInfo object is structured,
File size in bytes.
Public CDN URL related to a file, may contain processing operations.
A string holding existing URL modifiers, i.e. processing operations in case those are present. Null otherwise.
Original file CDN URL with no modifiers.
Object holding original image properties, if your file is an image,
null otherwise. Properties:
Object holding the info about a file source. For example, this can be a name of a social media, public URL, etc.
We do not store such information hence it is only available on the page where your file uploading happens.
Here is how an
uploadInfo object is structured,
Current upload states:
Upload progress as a value ranging from 0 to 1.
File ready state combines the progress of both upload and preparing info, as a value ranging from 0 to 1.