Take the 2-minute tour ×

I'm trying to write a script that will allow a user to upload a picture taken by (or selected from) their phone when on my jquerymobile driven site. I've found that AJAX doesn't allow file submissions in a form and I will have to use the following line

<form method=”POST” enctype=”multipart/form-data” action=”process_update.php” data-ajax=”false”>

for the form itself, but I can't find anyway to tell the smartphone to prompt the user to choose between selecting a photograph on their phone or taking a new one.

How do I accomplish this? Would I be better off looking into using some sort of plugin?

I plan on performing cropping and size changes on the server side as part of the form submission.

share|improve this question
add comment

1 Answer

When using a Samsung Galaxy S II device's browser (webkit = 534.30) and the following form:

<form method="POST" enctype="multipart/form-data" action="process_update.php">
  <input type="submit" />

The device prompts me to choose camera or gallery when pressing the file input button. I believe it's the accept="image/*..." attribute that's triggering this behavior in webkit.

share|improve this answer
Do you know if thats a universal command, or does that just effect android phones? –  VikingGoat Oct 11 '12 at 2:16
iOS webkit blocks file upload with inputs: stackoverflow.com/a/4082032/1367983 Confirmed as much with ipad just now. –  Kirk B. Oct 11 '12 at 3:52
Interesting thing; if I'm reading that correctly, iOS6 is the first version to allow it seems. –  VikingGoat Oct 11 '12 at 22:53
add comment

Your Answer


