Background Upload Plugin for Cordova
The following browsers are supported:
- Latest Firefox, Chrome, Safari
- IE10 through latest
Note: Background uploads are not supported on the web
When in a mobile environment, it will rely on the cordova-plugin-background-upload to allow for background uploads. If the plugin is not installed,it will fallback to superagent upload.
npm install --save cordova-background-upload
For mobile uploads:
cordova plugin add cordova-plugin-file --save cordova plugin add cordova-plugin-background-upload --save
For android, you need to add the permission library also:
cordova plugin add cordova-plugin-android-permissions --save
;var uploader = ;uploader;uploader;uploader;
Adding an upload is done via the
method. In case the plugin was not able to enqueue the upload, an exception will be thrown in the error event listener.
var payload ="id": "sd4ed""file": fileObject //the file object obtained from an input type='file'"serverUrl": """headers":"api_key": "asdasdwere123sad""parameters":"signature": "mysign""timestamp": 112321321;uploader;
- id: a unique identifier to track the uploads (String)
- filePath: the absolute path for the file to upload (applicable only on mobile platforms), if you are using an html input type file, write the file to disk, then use its path
- file: the file object obtained from an input type='file' (used only on browser)
- serverUrl: remote server url
- headers: custom http headers
- parameters: custom parameters for multipart data
cordova-background-upload is brought to you by Spoon Consulting.