I am facing problem here as in phonegap image is uploaded to the server once u select a picture.I don\'t want to upload image before submitting form. Image is uploaded automatic
I could not get these plugins to upload a file with the other answers.
The problem seemed to stem from the FileTransfer plugin, which states:
fileURL: Filesystem URL representing the file on the device or a data URI.
But that did not appear to work properly for me. Instead I needed to use the File plugin to create a temporary file using the data uri to get me a blob object: in their example, writeFile
is a function which takes a fileEntry
(returned by createFile
) and dataObj
(blob). Once the file is written, its path can be retrieved and passed to the FileTransfer instance. Seems like an awful lot of work, but at least it's now uploading.