title: How to correct the extension specification in this file uploading script?
body: <p>I am making an upload script and i have coded so that no file except image would not be uploaded but the script is also uploading other files and also when i echo the extension it just displays the strpos of $name. Can anyone help???? I have saved two files, 1) uploader.php and 2) uploader2.php. The uploader.php contains form of the uploading script</p>
  
  <pre><code>    &lt;h1&gt;Upload your pictures for free&lt;/h1&gt;
  &lt;form action="uploader2.php" method="post" enctype="multipart/form-data"&gt;
  &lt;input type="file" name="uploads"&gt;
  &lt;input type="submit" value="Update"&gt;
  </code></pre>
  
  <p>The uploader2.php contains the uploading script to folder uploads/</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL ^ E_NOTICE);
  $name = $_FILES['uploads']['name'];
  echo $type= $_FILES['uploads']['type'];
  $extension = strtolower($name,strpos($name,'.')+1));
  $size = $_FILES['uploads']['size'];
  
  $max_size = "20000000";
  $t_n = $_FILES['uploads']['tmp_name'];
  
  if(isset($name)) {
  if(!empty($name)) {
  
  if(($extension=="jpg" || $extension=="jpeg" || $extension=="bmp" || $extension=="gif")                            &amp;&amp; ($type="image/jpeg" || $type="image/bmp")&amp;&amp;($size&lt;=$max_size)){
  
  $location="uploads/";
  
  if(move_uploaded_file($t_n,$location.$name)){
  echo "Uploaded!";
  }else{
  echo "An error occured";
  }
  }
  else{
  echo "The uploading file must be jpg or jpeg and should have size less than 1mb";
  }
  }
  
  else {
  echo "Please choose a file";
  }
  }
  
  ?&gt;
  </code></pre>