PhoneGap upload Image to server on form submit

前端 未结 4 1625
南旧
南旧 2021-01-31 06:29

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

4条回答
  •  天涯浪人
    2021-01-31 06:58

    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.

提交回复
热议问题