In the process of developing a PhoneGap application that involves capturing images using the camera and subsequently uploading them, I have encountered an issue. In PhoneGap, there are two modes for camera operation: raw base64-encoded data or a file URI.
According to the documentation:
Note: The image quality of pictures taken with the camera on newer devices is excellent. However, encoding these images using Base64 has resulted in memory problems on certain devices such as iPhone 4 and BlackBerry Torch 9800. As a solution, it is strongly recommended to use FILE_URI as the 'Camera.destinationType'.
I am interested in utilizing the FILE_URI option. It functions effectively, allowing me to display images in IMG tags. An example of the URL structure is as follows:
file://localhost/var/mobile/Applications/4FE4642B-944C-449BB-9BD6-1E442E47C7CE/tmp/photo_047.jpg
However, at a later point in time, I need to access the contents of the file in order to upload it to a server. Initially, I attempted to achieve this using the FileReader type but encountered difficulties due to an inability to access the file via the aforementioned URL.
The error code I receive from readDataUrl is 1:
FileError.NOT_FOUND_ERR = 1;
Do you have any suggestions on how I can successfully locate the file? I experimented with extracting just the last part of the path (photo_047.jpg) based on another example I came across, but unfortunately without success.