Class SpazFileUploader
Defined in: spazfileuploader.js.
Constructor Attributes | Constructor Name and Description |
---|---|
SpazFileUploader(opts)
A File uploader class opts = { api:'', startEvent:'', successEvent:'', failureEvent:'', eventTarget:DOMElement } |
Method Attributes | Method Name and Description |
---|---|
getAPIKey(api_key)
some services require an api key or app identifier. |
|
returns an array of API labels |
|
getAPIs()
This builds the apis hash and returns it. |
|
setAPI(apilabel)
Pass the api you want to use as a string |
|
setAPIKey(api_key)
some services require an api key or app identifier. |
|
upload(file_url, opts)
a wrapper for uploadFile that uses the upload_url from the API definition |
|
uploadAndPost(file_url, opts)
a wrapper for uploadFile that uses the post_url from the API definition |
|
uploadFile(post_url, file_url, opts)
opts = { 'api':'', // use if not set already 'username':'xxx', 'password':'xxx', 'source':'xxx', 'message':'' } This uploads a file located at the given file_url. |
SpazFileUploader(opts)
A File uploader class opts = { api:'', startEvent:'', successEvent:'', failureEvent:'', eventTarget:DOMElement }
- Parameters:
- opts
getAPIKey(api_key)
some services require an api key or app identifier. This sets that.
- Parameters:
- {string} api_key
setAPIKey(api_key)
some services require an api key or app identifier. This sets that.
- Parameters:
- {string} api_key
upload(file_url, opts)
a wrapper for uploadFile that uses the upload_url from the API definition
- Parameters:
- file_url
- opts
uploadAndPost(file_url, opts)
a wrapper for uploadFile that uses the post_url from the API definition
- Parameters:
- file_url
- opts
uploadFile(post_url, file_url, opts)
opts = { 'api':'', // use if not set already 'username':'xxx', 'password':'xxx', 'source':'xxx', 'message':'' } This uploads a file located at the given file_url. It uses the sc.helpers.HTTPUploadFile as defined for your given platform. Events are raised as set in the constructor on start, success and failure. Note that in the webOS implementation, success events are raised every time progress is reported, NOT just when completion happens. Check for the "completed" boolean property in the response object. This may change in the future.
- Parameters:
- {string} post_url
- the url we're uploading the file to
- {string} file_url
- the local url of the file we're uploading
- {object} opts
- a set of key/val pairs