HTML File Upload Doesn't Show Gallery on Android

Jared picture Jared · Jun 28, 2014 · Viewed 16.3k times · Source

I'd like my PHP app to accept a photo chosen from a mobile user's gallery. I'm testing on Android 4.4.4 using Chrome. This is my form:

<form enctype="multipart/form-data" action="index.php" method="POST">
  <input type="hidden" name="MAX_FILE_SIZE" value="20000000" />
  <input type="submit" value="Add" />
</form>

I've tried three different type="file" inputs and none of them give me the Gallery as an option:

  <input name="userfile" type="file" />

Options: Camera, Camcorder, Sound Recorder and Documents

  <input name="userfile" type="file" accept="images/*" />

Options: Camera and Documents

  <input name="userfile" type="file" accept="images/*" capture />

Goes straight into Camera.

Is there some straight-forward way to get Gallery to come up as an option or do I have do some round-about thing using JavaScript? Thanks for your answers.

Answer

Szmulik picture Szmulik · Mar 12, 2015

Try to use <input name="userfile" type="file" accept="image/*" />

instead of <input name="userfile" type="file" accept="images/*" />.

It works for me.