I'm writing an app with Phonegap & Ionic that contains email-like functionality. For attaching files, I'm using a directive that basically wraps a regular HTML "file"-type input, giving me access to the file as a File object: https://developer.mozilla.org/en/docs/Web/API/File
So the user clicks a "Attach" button and it brings up the stock Android file dialog (I think it's a stock app called "Downloads" - same thing that pops up if you attach something in Gmail for example).
If I select something from "Images" or "Documents", everything works fine and I get a File with the "name" and "type" fields filled out correctly.
If I select something from "Downloads", I get the File object but the name will be a number with no file extension (ie "2142") and "type" will be null.
I can't find any way to get access to the real name/size of the File. Any ideas?
This is on Android 4.4.4, Phonegap 3.6.3-0.22.1.
Here's the file input I'm using:
<input class="hidden" type="file" id="browse" accept="*"/>
Here's the code that fires on a change event in the file input:
angular.element(document.getElementById('browse')).on('change',function(e){
var file = e.target.files[0];
$rootScope.$broadcast('selected', { file: file });
});
And here's an example file object selected from the Downloads directory:
{"webkitRelativePath":"", "lastModifiedDate":"2014-12-10T14:12:54:OOOZ","name","2393","type":"", "size":62646}
All assistance gratefully received!