Re: Is this really a pdf?
| From: | Colin Guthrie | Date: | Mon, 07 Aug 2006 16:58:00 +0000 |
| Subject: | Re: Is this really a pdf? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240266@lists.php.net to get a copy of this message | ||
Rory Browne wrote:
http://uk.php.net/manual/en/function.mime-content-type.phpIs this to protect against somebody trying to pass an mp3 off as a PDF, or to stop people mistakenly uploading PDF's. If it's the latter, then mime functions are probably okay. If the former, then you may want something a little more through. snip
(or other versions - perhaps just verify the first 4 chars. You can do this with a simple snip
Absolutely! Incredibly insecure! :) But again as you stated yourself, if it's just to help users rather than preventing unotherised content, then either way would work most of the time. It would be fairly trivial to write a valid PDF that was actually an MP3 encoded specially, a few pages or so of base64 would do!! Col. Col.This is very simple.And very insecure. All it takes is a cat and echo to disguise a file as a PDF, and a quick 'dd skip' to Undisguise it.