7656 fix phonegap app crashing

Refactored file handling to handle the app returning file URI when capturing photos.
do we need to check both can we move the codes to constants