Phonegap Build: download image in one of the folders of your app

前端 未结 2 923
夕颜
夕颜 2021-01-07 08:21

I am able to download an image if I specify the path directly with

file:///storage/sdcard0/

How can I save an image to my one o

2条回答
  •  伪装坚强ぢ
    2021-01-07 09:18

    I would use the folder alias as defined in the plugin docs here (https://github.com/apache/cordova-plugin-file/blob/master/doc/index.md). Specifically cordova.file.dataDirectory. Note that this is not, afaik, under the www of your original project, but it seems to be the preferred place to store downloads. Once saved there you can resolve that to a URL that you could use to load via AJAX, or in an img tag if you are downloading graphics.

提交回复
热议问题