Steps to browse file from File system in PhoneGap

Posted By : Akhil Dhiman | 26-Feb-2015
Browse file system in Phonegap

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

About Author

Author Image
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.

Request for Proposal

Name is required

Comment is required

Sending message..