Im trying to limit my upload to only upload file extensions with a pdf. I've previously got the upload working but with any extension using ;
$form = $_FILES['form']['name'];
$upload = "forms/$form";
move_uploaded_file($_FILES['form']['tmp_name'],$upload);
I'm now trying to adjust this to only upload pdf, Using the following;
if (isset($_FILES['file']))
$exten = explode( "." , $_FILES['form']['name']);
$exten = $exten[1];
$form = $_FILES['form']['name'];
$upload = "forms/$form";
if (
($exten == "pdf")
|| ($exten == "PDF")){
move_uploaded_file($_FILES['form']['tmp_name'] , $upload);
}
However the files are not uploading to the directory anymore plus it accepts any extension. It is entering the filename within my database. I followed a tutorial for this but not sure where I've gone wrong
somefile.pdf.ugly.isset($_FILES['file'])?