title: PHP Upload - Allow only jpg files
body: <p>This is what I currently have:</p>
  
  <pre><code>$file_name = $HTTP_POST_FILES['uid']['name'];
  $user= 'FILENAME';
  $ext = pathinfo($file_name, PATHINFO_EXTENSION);
  $new_file_name=$user . '.' . $ext;
  $path= "uploads/images/users/".$new_file_name;
  if($ufile !=none)
  {
    if(copy($HTTP_POST_FILES['uid']['tmp_name'], $path))
    {
    echo "Successful&lt;BR/&gt;"; 
    echo "File Name :".$new_file_name."&lt;BR/&gt;"; 
    echo "File Size :".$HTTP_POST_FILES['uid']['size']."&lt;BR/&gt;"; 
    echo "File Type :".$HTTP_POST_FILES['uid']['type']."&lt;BR/&gt;"; 
    }
    else
    {
    echo "Error";
    }
  }
  </code></pre>