Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Html File Input on Android 5.1.1 doesn't show gallery

Tags:

html

android

This is what I'we tried:

<input id="capture" name="capture" type="file" accept="image/*" capture="camera">
<input id="capture" name="capture" type="file" accept="image/*" capture>
<input id="capture" name="capture" type="file" accept="image/*;capture=camera">
<input id="capture" name="capture" type="file" accept="image/*;capture=camera" capture>

This is the user agent string:

Mozilla/5.0+(Linux;+Android+5.1.1;+SM-J320FN+Build/LMY47V)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/53.0.2785.124+Mobile+Safari/537.36

The problem i'm facing is that for some reason this android device goes directly to camera (opens camera), without showing any options to choose a file from the gallery or take a picture by using camera.

Any suggestion how to overcome this?

like image 589
HABJAN Avatar asked Oct 28 '16 12:10

HABJAN


2 Answers

This is a problem with android. You are doing everything right and it will work fine on computers. Android does not show an option to choose an image from gallery directly. When clicking the button to upload you can choose "Documents" from the option that pops up and when you slide from left to right you will see an option named gallery. By clicking on it you can select an image from the gallery. Unfortunately, I think this is the only way around. Hope this helped.

like image 60
Ronald P Mathews Avatar answered Oct 20 '22 21:10

Ronald P Mathews


This is not your fault. Tested this on android 4.4, 5 and 6 and none of them worked for me, but in chrome only. Firefox gives me options.

Digging around, I found this issue in android 4.4>. It's an old thread, but nothing else make sense.

like image 26
Aleksandar Avatar answered Oct 20 '22 20:10

Aleksandar