I am creating a hybrid app using cordova version 6.3 . On Android, I would like to the user to select a file from their device. Basically, i want a file chooser to show up and then the user select a file that is store on the android phone.
The current input type="file" does not work. It did work with a different version of SDK(19) and cordova
Can you give me some hint or some some sample code showing how I can implement this feature
The <input type="file"> element also doesn't work as you'd expect in iOS -- it displays a list of photos IIRC.
I ended up writing my own routine to iterate through the phone's directories (using the plugin cordova-plugin-file) and gather the files -- see https://stackoverflow.com/a/29905718/346550. After getting the list, I display the entries in an unordered list of hyperlinks. You could really display the file results however you wanted, though.
Related
I have an HTML form page that includes the following lines:
<form action="/action_page.php">
<input type="file" name="files[]" id="files" accept="image/*" multiple directory="" webkitdirectory="" mozdirectory=""/>
<input type="submit">
</form>
It is intended to allow a user to select a folder of images, instead of individual image files. This works correctly on my desktop PC. It allows me to select the folder where my images are, instead of selecting individual image files.
Now I need to have this work on Android tablets. The problem is, on Android, this opens up a little folder tree, the user taps tree nodes "camera"/image and the photo thumbnails in the gallery are displayed on the right hand side, then the user is unable to select multiple images (or even one image). What happens is, the user single taps (or double taps, or long taps) an image, and the images view immediately closes and the user is returned to the form web page, and the input control says "No file selected". The exact same behavior is manifested in the built-in Android browser and Chrome for Android.
How can I allow the user to either select just the folder where the images are, or, select all the images (or even one image at this point), so that the input control knows that all photos (or all photos, highlighted or checkmarked, or what ever) are selected for upload on an Android device?
(Or is there some unknown action the user needs to take while in the Gallery, like tap something, or long tap something, to achieve this?) Thanks in advance for any help you provide.
SOLVED: It turns out that Android is unable to select a directory, so it ends up in a lame condition where it simply displays the directory, but won't let you select the directory.
The solution is to REMOVE all the "directory" attributes. So the input line shd be as follows:
<input type="file" name="files[]" id="files" accept="image/*" multiple />
This is understood by Android and will allow you to select multiple files as expected.
I'm using WordPress and Contact Form 7 plugin on this page. There is a file upload field, it's simple and valid HTML:
<input type="file" name="your-cv" size="40" class="wpcf7-form-control wpcf7-file wpcf7-validates-as-required" accept=".doc,.docx,.pdf" aria-required="true" aria-invalid="false">
The form works perfectly on desktop, iOS, but Android users can’t use file upload. They just cannot choose a file with “file chooser” on android. After they click on “file picker”, android dialogue window with “no apps can perform this action” text will appear.
android screenshot
How can I solve this? Users reported, that they don't have such problem on other websites.
Thanks.
I run my app in Ionic Framework using ionic run android.
What I need is to retrieve all the images in the sdcard of emulator and display it in my view.
I tried using camera.getPicture(), but in that function, a list of images in sdcard will be displayed first and from that list, I have to select the images that I need.
But what my requirement is that, I want all the photos from the sdcard to be displayed directly in my view. Is there any function to make it possible?
You cannot do this by using ionic framework only. Cordova is used to do this action which you need. following link may be helpful for you. :)
I am using the cordova 3.4.0 and trying to upload a file, using the file transfer and file api plugins given by cordova, but i am not able to open the file browser window, in order to select the file to upload. How do i open the file browser window in android using the corodva
I used an Input tag in my html, like so:
<input type='file' id='fileInput'>
And then when it is clicked on the Android device, I get a pop-up asking me which file browser I want to use. My Galaxy S3 gives me seven choices (one of which is a downloaded app), and the Panasonic ToughPad I'm developing for gives me three (one of which is the same downloaded app I have on the phone).
I do not know if it is possible to get it to automatically select one in particular - for me, choosing a file manually is supposed to be a temporary need, as eventually the app is supposed to load specific files automatically.
and if this application exist does it has an open API?
nop theres no API to support that, and this is the only way that I Know
Word, Excel, PowerPoint and Adobe PDF files on your Android-powered Smartphone
An app like QuickOffice or Documents To Go comes on every Android I've seen. If it already has the app then the following should work: Android Launching an application chooser with appropriate list of applications