I am working on a PhoneGap application that captures images using a camera and then downloads them. There are two camera modes in PhoneGap: raw base64 encoded data or a file URI.
The documents themselves say:
Note. The image quality of images taken with the camera on a newer device is not bad. Encoding such images using Base64 has caused memory problems on some of these devices (iPhone 4, BlackBerry Torch 9800). Therefore, using FILE_URI as "Camera.destinationType" is highly recommended.
Therefore, I really want to use the FILE_URI parameter. This works great, and you can even display images in IMG tags. The url is as follows:
File: //localhost/var/mobile/Applications/4FE4642B-944C-449BB-9BD6-1E442E47C7CE/tmp/photo_047.jpg
However, at some point I want to read the contents of the file to upload to the server. I was going to do this using the FileReader type. This does not work, and I think because I can’t access the file at the above URL.
The error code returned from readDataUrl is 1> FileError.NOT_FOUND_ERR = 1;
Any ideas how I can get to the file? I tried just to access the last part of the path (photo_047.jpg) based on another sample that I saw, but no luck.
source
share