{% extends "_templates/base.html" %}
{% block content %}
{% markdown %}
## FineUploaderBasic mode API functions ##
* `log(String message)` - Outputs a message to the javascript console, if possible.
* `setParams(Object newParams, [optional] Number id)` - Set the parameters sent along with the request after initializing the uploader.
You can either change the parameters for a specific file or `Blob`, or for all files and `Blob`s. To do the latter, simply omit the `id` parameter.
See this [blog post explaining parameters](http://blog.fineuploader.com/2012/12/05/include-params-in-the-request-body-or-the-query-string/)
as well as [this one explaining how this function works in 3.1 and later versions](http://blog.fineuploader.com/2012/12/09/setparams-is-now-much-more-useful-in-3-1/).
* `setEndpoint(String endpointPath, [optional] Number id)` - Modify the location, after initializing the uploader, where upload requests should be directed.
You can either change the endpoint for a specific file or `Blob`, or for all files and `Blob`s. To do the latter, simply omit the `id` parameter.
* `uploadStoredFiles()` - If `!autoUpload`, this will begin uploading all queued files and `Blob`s.
If there are no items to upload, this will result in "no files" error.
* `clearStoredFiles()` - Clears the internal list of stored files and `Blob`s. Only applicable when `autoUpload` is set to false.
* `getInProgress()` - Returns the number of files or `Blob`s that are either currently uploading or waiting in line to be uploaded. Note that calling this method inside of an onCancel callback will return a value that includes the upload associated with the onCancel callback. This is due to the fact that the upload will not be cancelled until the onCancel callback returns, since this callback provides the opportunity to prevent the upload from being cancelled by returning false inline or via a promise.
* `getNetUploads()` - Returns the number of files or `Blob`s that have both been successfully uploaded and have NOT been deleted.
* `retry(String id)` - Orders the uploader to make another attempt at uploading a specific file or `Blob`. A NO-OP if the server
prohibits retries on a failed file via the preventRetryResponseProperty. Note that this operation does
respect the maxConnections value, so if all connections are accounted for, the retry attempt will be queued
until a connection opens up.
* `cancel(String id)` - Cancels a queued or currently uploading file or `Blob`.
* `cancelAll()` - Cancels all queued or currently uploading files or `Blob`s.
* `reset()` - While this function is most useful for FineUploader, it is also available in FineUploaderBasic. In FineUploader,
calling this function will reset all UI elements to the state they exsited in immediately after initialization. In FineUploaderBasic,
this resets all internal variables to the state they existed in immediately after initialization. If you are using FineUploaderBasic,
it is up to you to "reset" any of your UI elements.
* `addFiles(filesOrInputs, (optional) params, (optional) endpoint)` - Use this if you would like to submit files to the uploader.
This may be useful if you have a method of gathering files that does not include Fine Uploader's input button or the drag & drop
support built into FineUploader. This function accepts the following types: `File`, `input` element, or a collection of
any of these types, provided the collection object contains an (integer) index property for each contained item. Note
that you can also pass parameters and/or an endpoint to associate with the passed file(s) or input(s).
* `addBlobs(blobDataArray, (optional) params, (optional) endpoint)` - Allows you to submit one or more `Blob` objects to
be uploaded. This is expected to be an array of `BlobData` objects. A `BlobData` object is simply defined by the
following convention: an object with a `name` property (used to assoicate a name with the `Blob`) and a `blob` property
(with a value equal to the `Blob` you would like to upload). Note that you may also simply pass one `Blob` or an array
of `Blob` objects. In each of these last two cases, a default name, defined in the `blobs` option, will be used. Also
note that your `Blob` objects must be `Blob` objects, but not `File` objects. In other words, `Blob` subtypes are not
acceptable. If you would like to upload `File` objects via the API, do so via the `addFiles` function. Note that you
can also pass parameters and/or an endpoint to associate with the passed `Blob` object(s).
* `getResumableFilesData()` - Returns an array of objects, each describing a file that is potentially resumable by this uploader instance.
If a `resume.id` property has been set, this is taken into consideration. Each resumable file is represented by an object with the
following properties: `name` - filename, `size` - file size, `uuid` - unique ID associated w/ the file, `partIdx` - index of the part where
the resume will start.
* `getSize(id)` - Returns the size of the `File` or `Blob` represented by the passed ID. Undefined if the file size cannot be determined, such as
if the user agent does not support the File API.
* `getName(id)` - Returns the name of the file or `Blob` represented by the passed ID.
* `setName(id, newName)` - Provide an alternate/new name for the associated file or blob.
This will be sent along with the upload request, by default, as the value of a "qqfilename" parameter.
You should only call this method before the upload request has been sent. Read
[the blog post about the edit filename feature](http://blog.fineuploader.com/2013/06/23/3-7-edit-override-file-names/)
in both FineUploader and FineUploaderBasic for more details.
* `getFile(id)` - Returns the `File` or `Blob` object associated with the passed ID. Undefined if the underlying `File` or `Blob` cannot be found,
or if the user agent does not support the File API. For more info on the `File` and `Blob` objects, please see
[the File entry in the W3C spec](http://www.w3.org/TR/FileAPI/#dfn-file) and [the Blob entry in the W3C spec](http://www.w3.org/TR/FileAPI/#dfn-Blob), respectively.
* `deleteFile(id)` - This allows you to programmatically order Fine Uploader to send a DELETE request for a specific file or `Blob`.
Fine Uploader actually uses the API call internally when a user clicks the delete link in FineUploader mode.
* `setDeleteFileEndpoint(String endpointPath, [optional] Number id)` - Same as the `setEndpoint` function except this applies only to the `deleteFile` option endpoint(s).
* `setDeleteFileParams(Object newParams, [optional] Number id)` - Same as the `setParams` function except this applies only to the `deleteFile` option parameters.
* `getUuid(id)` - Retrieves the UUID associated with a file or `Blob`, given a current session file or `Blob` ID.
* `doesExist(id)` - Returns true if the associated file or `Blob` is a currently registered with Fine Uploader.
* `getUploads(optionalFilter)` - Get information about all files or `Blob`s that have been submitted to the uploader during
this session. The return type is either a single object (filter by single ID, filter by single UUID), or an array of
objects (filter by array of IDs or UUIDs, filter by status, no filter). The object referred to here has the following
properties: `id`, `uuid`, `originalName`, `name`, `size` (if available), and `status`. The status values correspond to "constants"
defined in the `qq.status` object. You may filter the results by one of the following filters: `id`, `uuid`, or
`status`. The filter may be a single value or an array of values. For example, if you would like to retrieve information
about the first 3 items submitted to the uploader, you would call `uploaderInstance.getUploads({id: [0, 1, 2]});`. Please
see [the blog post on upload stats retrieval](http://blog.fineuploader.com/2013/05/24/query-fine-uploader-for-upload-stats/)
for more details and examples.
{% endmarkdown %}
{% endblock %}