Upload a file
You can upload a file to a remote server using an HTTP multi-part POST request.
- returns - None
- fileName – Absolute or relative path of a file name (including file name)
- url - The remote server URL
- successCallback - The function to be invoked upon success/completion
- errorCallback - The function to be invoked if there is a file transfer error
The following options are also supported:
-trustAllHosts - Defaults to false. If set to true, it accepts all the security certificates. This is useful because Android rejects self-signed certificates. It is not recommended to set this as true for production use.
See Getting Started Examples
//A function to capture and uplaod an image to a remote server
var uploadOptions = new FileUploadOptions();
uploadOptions.chunkedMode = false;
var fileTransferObj = new FileTransfer();
alert("File uploaded to the server");
alert("Error uploading file to the server");