security check for a pdf file during upload in php -


this question has answer here:

i trying check pdf before upload.

i want check pdf malicious or not.

for example: save php file pdf , upload it. server shows error not valid pdf.

so how can check pdf real or not in php?

please see fileinfo extension php: http://www.php.net/fileinfo example of usage here: http://www.php.net/manual/en/function.finfo-open.php
l.e: please note, fileinfo way should check file types. not use extensions check against file type, huge mistake.
also, if fileinfo not available reason , cannot install , have shell access, can : $info = exec('file -ib ' . escapeshellarg($filepath)); print_r($info);


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -