is there a code that only allows pdf file in uploading in php?

samuel101

New member
is there a restriction code using php that only allows pdf files to be uploaded? here's my code that allows png files only:

if ($type == "image/png")
{
$loaddir='upload/';
$image =$loaddir.basename($_FILES['userfile']['name']);
$dest=$loaddir.basename($_FILES['userfile']['name']);
}
else
{
echo "<br>Only PDF file can be uploaded!";
}
so if i did all this restrictions, only pdf files can be uploaded?
 
Back
Top