How can I move the image captured from my phone camera to the Cordova app directory?
I want to move the file to, ideally with mkdir like function for new directories
app/www/uploads/new
The image location of the file is saved in a var:
imagePath = file://emu/0/android/cache/something.jpg
Any help is welcomed.
I am using Cordova version 4.1.2 and installed the Cordova File Plugin.
I do think that the
app/www
directory is read-only since it contains your actual code and is packaged as .apk. Why would you need it there though? It is still since it is on disk. If you want to copy it for your own applications data partition, you should use the File plugin that you already mentioned to move it under cordova.file.externalDataDirectory or some other place you wish to move it.Update
Since you want to show the file as image on HTML, the easiest way is to read it as Data URL (base64 format) and give that as src for image instead of path for file like this
The structure for that code is borrowed from the Pratik Sharma's answer and it may not completely work for your case but you should be able to pick up the idea from there. It relies on that you have this kind of image tag available on your HTML.
If you want to read more about this, consult this Wikipedia article.