7656 fix phonegap app crashing

Refactored file handling to handle the app returning file URI when capturing photos.
Came from Wei's hop-on