I have a file upload system in a site which allows upload of .doc, .docs and .pdf files. Currently the PHP script allows upload of any file type. I would like to restrict it to only allow uploading of genuine PDF DOC and DOCX files. I have read that this is best done via checking the MIME type / headers of the file - but cant seem to find an agreed best solution to do this anywhere.
Any tips on the best way to achieve this?
Current upload PHP is:
$meta = $dropbox->UploadFile($_FILES["fileInputFieldName"]["tmp_name"], $upload_name);
Appreciate any tips on how to integrate this into the suggestions please.