Class SpazFileUploader

Defined in: spazfileuploader.js.

Class Summary
Constructor Attributes Constructor Name and Description
 

A File uploader class opts = { api:'', startEvent:'', successEvent:'', failureEvent:'', eventTarget:DOMElement }

Method Summary
Method Attributes Method Name and Description
 
getAPIKey(api_key)

some services require an api key or app identifier.

 

returns an array of API labels

 

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.

Class Detail

SpazFileUploader(opts)

A File uploader class opts = { api:'', startEvent:'', successEvent:'', failureEvent:'', eventTarget:DOMElement }

Parameters:
opts
Method Detail

getAPIKey(api_key)

some services require an api key or app identifier. This sets that.

Parameters:
{string} api_key

getAPILabels()

returns an array of API labels

Returns:
array

getAPIs()

This builds the apis hash and returns it. All API stuff is defined inside here

setAPI(apilabel)

Pass the api you want to use as a string

Parameters:
{string} apilabel

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