-
PHP Validate Uploaded File is PDF
How do I check if the uploaded file is pdf with php? I want to validate the file type is pdf and not just the extension matches pdf.
thanks.
-
Just to clarify. I need to validate 2 files and send them with phpmailer to an email address. Will the below works?
if(isset($_FILES['upload']['tmp_name'])){
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime=finfo_file($finfo, $_FILES['upload']['tmp_name']);
if($mime=='application/pdf'){
$mail->AddAttachment($mime);
} } }
finfo_close($finfo);
}
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks