I need to implement the file upload function in my phonegap project. The user should be able to download files of any type from the phone or SD card. The screens of the applications that I developed using the jQuery Mobile platform. I tried input type = "file", but it is not supported in android 4.4. I also tried the camera API for phone calls, but it is only supported by media files. I found some cordova plugins ( exm1 , exm2 ). But these plugins use the user interface. I want to call my own file browser to select a file, and it should work on Android and iPhone platforms. Is there a way to implement the same?
I found the plugin to select the cordova file ( https://github.com/cdibened/filechooser ) will be useful for the Android platform, but I can not get it to work. The success callback function does not immediately start after selecting a file (verified using android 4.4.2). Please find my code below.
<input type="file" id="fileinput" name="fileinput"/>
$("#fileinput").bind('click',function(){ console.log("choose file selected"); filechooser.open( {}, fileChooseSuccess, fileChooseFailed ); }); function fileChooseSuccess(data) { var filepath = data.filepath; console.log("file path:"+filepath); } function fileChooseFailed(msg) { console.log(msg); }
jquery-mobile cordova cordova-plugins
Sinu varghese
source share