I am developing an android app using phonegap.
we need to access images on mobile and upload that to server. Iam using a html input tag to upload image
<input uploadonchange id="fileData" type="file" accept="image/*" name="upload" />
onchange I am calling method and reading file details to check the file name and type in js
var fileinput = document.getElementById("fileData");
var file = fileinput.files[0]
but iam not getting file details like type. i can see that file size is updated with actual file size, but the name of the file is not same as actual file name. type property is empty.
I tried to implement this on a html page and load it from chrome browser. it works fine there. and prompt i got on chrome is a "Choose an action" lightbox with camera,camcorder,soundrecorder,documents
when uploading from my android app i got android "Open from".
permissions in android manifest are
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.transmit.transmit.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.transmit.transmit.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.CAMERA" />
android studio log's at hte time of uploading image
12-20 19:45:21.599 2452-2452/com.phonegap.helloworld D/CordovaActivity﹕ Paused the application!
12-20 19:45:21.600 2452-2452/com.phonegap.helloworld D/CordovaWebView﹕ Handle the pause
12-20 19:45:22.055 2452-2452/com.phonegap.helloworld W/IInputConnectionWrapper﹕ showStatusIcon on inactive InputConnection
12-20 19:45:32.152 2452-2452/com.phonegap.helloworld D/CordovaActivity﹕ Incoming Result
12-20 19:45:32.152 2452-2452/com.phonegap.helloworld D/CordovaActivity﹕ Request code = 5173
12-20 19:45:32.152 2452-2452/com.phonegap.helloworld D/CordovaActivity﹕ did we get here?
12-20 19:45:32.152 2452-2452/com.phonegap.helloworld D/CordovaActivity﹕ result = content://media/external/images/media/10249
12-20 19:45:32.153 2452-2452/com.phonegap.helloworld D/CordovaActivity﹕ Resuming the App
name attribute we see in javascript is not same as actual filename. androidstudio log "content://media/external/images/media/10249" there no such file in mobile.