Verifying mime type of pdf files on upload in PHP -


I am working on the project for which file upload is required to ensure that it is safe and only Uploading PDF files I'm already checking file extensions, but I have to make sure that the file is actually a PDF file.

What is the best way to check mime type in php? I am using PHP 5.2.5 and can not seem to be working in the fileinfo or mime_sign_type ().

I am receiving it for fileinfo:

  WARNING: finfo_open () [Function.finfo-open]: Loading the Magic Database on '(empty)' Failed in 35 [[filename] [35]  

Mime type type checking Files are not reliable for A customer's browser may report it incorrectly.

The PDF file starts with "% PDF" (25 50 44 46).


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -