Making file upload feature for your PhoneGap app
In my previous post, I have given very high level concept of adding this feature to the app. In this post, I will walk you through techincal way of doing this.
To add this feature, we need to add two plugins to our project(cordova/phongap) that access device's camera and file system. These are mentioned below:
-
Camera : - The camera object provides access to the device's default camera application.
-
File :- An API to read, write and navigate file system hierarchies, based on the w3c file api.
Go through the documentations to find out appropriate methods for your scenario. In this demo, Camera clicks a new picture or picks any file from gallery and then file is read by File plugin giving its metadata information(like base64Encoded body, MIME Type, Size etc...).
Below are the videos recorded on actual devices:
You can find full working code here
Hope this helps!
If anyone need my help on this, contact me here or send me an email directly.
Related Posts:
Adding file upload feature in your phoneGap application.
Getting issues in reading videos' url in IOS + PhoneGap App.