Skip to content

Latest commit

 

History

History
82 lines (60 loc) · 6.83 KB

api-fineuploaderbasic.md

File metadata and controls

82 lines (60 loc) · 6.83 KB

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 Blobs. To do the latter, simply omit the id parameter. See this blog post explaining parameters as well as this one explaining how this function works in 3.1 and later versions.

  • 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 Blobs. To do the latter, simply omit the id parameter.

  • uploadStoredFiles() - If !autoUpload, this will begin uploading all queued files and Blobs.

  • clearStoredFiles() - Clears the internal list of stored files and Blobs. Only applicable when autoUpload is set to false.

  • getInProgress() - Returns the number of files or Blobs that are either currently uploading or waiting in line to be uploaded.

  • getNetUploads() - Returns the number of files or Blobs 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 Blobs.

  • 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.

  • 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 and the Blob entry in the W3C spec, 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 Blobs 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, 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 for more details and examples.