Steps to browse file from File system in PhoneGap
Posted By : Akhil Dhiman | 26-Feb-2015
Here I will show you how one can browse file from filesystem.
Platform Supported - Android
Description
File Chooser helps user to browse file from file system and attach it as attachment and send it to server.
Plugin to use:
I used plugin named FileChooser you can use the following link to check the plugin at Github
To add this plugin in your project follow the following procedure:
Using terminal go in your project directory, from inside your cordova project you have to enter the following command:
cordova plugin add http://github.com/don/cordova-filechooser.git
After installing plugin make a control in HTML on click of which you need to browse file from file system. While we click on button it will open an pop up that will help you in browsing your file. The pop up comprises of different sections like:
- Recent
- Images
- Videos
- Audio
- Downloads
- Gallery
- Photos
- Any Third Party Browsing application
Pop up window to browse file will be open by following code:
fileChooser.open(function(uri) {
alert(uri);
});
When you select any file it will return its URI to you that we will give as reference to attachment on submitting form, we will send file across server.
Thanks
Request for Proposal
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Akhil Dhiman
Akhil is an iPhone and Android application developer with experience in PhoneGap and Swift(Native iOS). Akhil has good experience working with JavaScript, jQuery and Underscore as well.