I've been trying and retrying at this code trying to get the file extension and conditionally check against it, but due to the files placement in flow I can't see what's going into $ext.
Can anyone pinpoint what is going wrong here? It's just manipulating the uploads file for dropzone.js.
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name']; //3
$targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds; //4
$targetFile = $targetPath. $_FILES['file']['name']; //5
$ext = end(explode(".", $_FILES['file']['tmp_name']));
if(filesize($tempFile) < 6000000 and $ext == "png"){
move_uploaded_file($tempFile,$targetFile); //6
}
}