On my website I allow users to upload an image using the following...
$max_filesize = 1572864; // 1.5MB
$upload_path = 'uploads'; 
$upload_path = $upload_path.'/';
$filename = $_FILES['profile_image']['name']; 
if(filesize($_FILES['profile_image']['tmp_name']) > $max_filesize)
      die('The file you attempted to upload is too large.'); 
if(!is_writable($upload_path))
      die('permission errorrr!'); 
if(move_uploaded_file($_FILES['profile_image']['tmp_name'],$upload_path . $filename)){
    // TA DA!
}
Im just after some input on how secure this, and how it can be made even more secure, I ask as Ive manage to change a file a .png file to .jpg and upload it, so in theory could a .exe be renamed and uploaded, and if so how can this be countered?
 
     
     
     
     
     
    