php - Unable to upload camera pictures -


firstly, new so, html & php, english isn't main language sorry if i'm offending in way or asking stupid questions.

i have a(n almost) functional upload function. uploading photo works in every way except when directly make picture phone.

i have samsung galaxy s2. (it seem work on iphone, haven't tested on other phones)

my form:

<form action='m.dier_plaatsen.php' method='post' enctype='multipart/form-data'>     <table>         <tr>             <td>                 kies een bestand:             </td>             <td>                 <input type='file' name='img1' value='choose file' />             </td>         </tr>         <tr>             <td>                 kies een bestand:             </td>             <td>                 <input type='file' name='img2' value='choose file' />             </td>         </tr>         <tr>             <td>                 kies een bestand:             </td>             <td>                 <input type='file' name='img3' value='choose file' />             </td>         </tr>     </table>      <input type='submit' class='button_styled' value='previous' name='prev7' />     <input class='button_styled' name='next7' type='submit' value='next' />  </form> 

my upload script:

if(isset($_files['img1'])){      $img1_file_name = $_files['img1']['name'];     $img1_file_ext = strtolower(end(explode('.',$img1_file_name)));     $img1_file_size = $_files['img1']['size'];     $img1_file_tmp = $_files['img1']['tmp_name'];      if($img1_file_ext !== ""){          $file_chosen = true;         $img1_set = true;          if(in_array($img1_file_ext, $allowed_ext) === false){             $errors[] = "extension not allowed";         }     }      if($img1_file_size > 1048576){         $errors[] = "file size must under 1mb";     } }  if(isset($_files['img2'])){      $img2_file_name = $_files['img2']['name'];     $img2_file_ext = strtolower(end(explode('.',$img2_file_name)));     $img2_file_size = $_files['img2']['size'];     $img2_file_tmp = $_files['img2']['tmp_name'];      if($img2_file_ext !== ""){          $file_chosen = true;         $img2_set = true;          if(in_array($img2_file_ext, $allowed_ext) === false){             $errors[] = "extension not allowed";         }     }      if($img2_file_size > 1048576){         $errors[] = "file size must under 1mb";     } }  if(isset($_files['img3'])){      $img3_file_name = $_files['img3']['name'];     $img3_file_ext = strtolower(end(explode('.',$img3_file_name)));     $img3_file_size = $_files['img3']['size'];     $img3_file_tmp = $_files['img3']['tmp_name'];      if($img3_file_ext !== ""){          $file_chosen = true;         $img3_set = true;          if(in_array($img3_file_ext, $allowed_ext) === false){             $errors[] = "extension not allowed";         }     }      if($img3_file_size > 1048576){         $errors[] = "file size must under 1mb";     } }  if(!$file_chosen){     $errors[] = "no file has been chosen"; }  if(empty($errors)){      $tmp_random1 = rand().".".$img1_file_ext;     $tmp_random2 = rand().".".$img2_file_ext;     $tmp_random3 = rand().".".$img3_file_ext;      while(file_exists("tmp/".$tmp_random1)){         $tmp_random1 = rand().".".$img1_file_ext;     }     while(file_exists("tmp/".$tmp_random1)){         $tmp_random2 = rand().".".$img2_file_ext;     }     while(file_exists("tmp/".$tmp_random1)){         $tmp_random3 = rand().".".$img3_file_ext;     }      if($img1_set){         move_uploaded_file($img1_file_tmp, 'tmp/'.$tmp_random1);         $_session['tmp_random1'] = $tmp_random1;     }     if($img2_set){         move_uploaded_file($img2_file_tmp, 'tmp/'.$tmp_random2);         $_session['tmp_random2'] = $tmp_random1;     }     if($img3_set){         move_uploaded_file($img3_file_tmp, 'tmp/'.$tmp_random3);         $_session['tmp_random3'] = $tmp_random1;     } } 

any ideas?


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -