File upload not working from IOS

Hi guys,

Thank you in advance for your help

Thanks to IOS 6 we can now upload photos straight from the iphone using either “Take Photo” or “Choose Existing”

“Choose Existing” is fine however when we select “take a photo” the upload fails.

We are using a standard html form that we have used for years. Could it be that the when we take a picture it is has no filename and this is causing the problem?


 <form action=thankyou.php method=post  enctype="multipart/form-data">
<input type=file name="photo1" id="message" placeholder="" class="required"  accept="image/*" capture>
 <input type=submit name=submit value="send feedback">
</form>


if(isset($_POST['submit'])){
 $target = "photos/";
 $target = $target . basename( $_FILES['photo1']['name']) ;
 $ok=1;
 $photo1=$_FILES['photo1']['name'];


 echo $_FILES['photo1']['tmp_name'];

 //This is our size condition
 if ($uploaded_size > 350000)
 {
 echo "Your file is too large.<br>";
 $ok=0;
 }

 //This is our limit file type condition
 if ($uploaded_type =="text/php")
 {
 echo "No PHP files<br>";
 $ok=0;
 }

 //Here we check that $ok was not set to 0 by an error
 if ($ok==0)
 {

 }

 //If everything is ok we try to upload it
 else
 {
 if(move_uploaded_file($_FILES['photo1']['tmp_name'], $target))
 {
   echo"Uploaded";
 }
 else
 {
  echo"Not Uploaded";
 }
 }
 }

If that’s your complete form php code, it’s extremely insecure - it’d be trivial to upload a malicious file.

It is purely for testing at the moment which is why it is basic, is their a reason why it would work on the web and not on IOS?

You might need to set capture=camera