SBO
SBO

Reputation: 623

target image folder on mobile (Android or IOS) when html input[type="file"] is clicked

i have this problem and can't figure out:

i have a simple input

<input type="file" id="mfile" name="file" class="input display-none optional_check" accept="image/jpg"/>

It works perfectly on desktop browsers but when i click it from a mobile device it opens a choiche between:

  1. File system or Document folder
  2. Camera
  3. Video
  4. Sounds

I would like to redirect the browse to the image folder of the mobile device like Facebook does.

Is it possible? Thank you!

EDIT 1:

putting accept="image/*" changed from (image/png,image/jpg,image/jpeg,image/gif) changed a little bit the situation avoiding choosing audio and video.

Now on Android 5.02 this is what i see: screenshot

while on Android 4.42 i see this:

screenshot2

What i want is getting the same choiches as android 4.4.2 in every device (IOS too).

Or if is possible doing like facebook wich goes straight to the images global folder.

It Seems to be a Android 5 Bug,anyone can help me?

Fiddle

Thanks!

Upvotes: 1

Views: 1660

Answers (1)

user3278087
user3278087

Reputation: 407

Your "accept" value is wrong. Try to use "image/*":

<input type="file" id="mfile" name="file" class="input display-none optional_check" accept="image/*"/>

Now it should work.

Upvotes: 1

Related Questions