On Mon, August 7, 2006 10:04 am, Ed Curtis wrote: > > On Mon, 7 Aug 2006, Sjef wrote: > >> Is it possible to recognize if a file for upload really is a pdf >> (like the >> function getimagesize retuns the file type of the image)? >> Thanxs, >> Sjef > > Yes it is. > > $_FILES['{form_field_name}']['type'] is your friend here. Just match > it > against a mime type your looking for. $_FILE[*]['type'] is pretty useless all around... It's useless as a Security method because a Bad Guy can send anything they want for that. It's useless in the general sense because IE and Mozilla-esque browsers send *different* MIME types for the same file. There is no standard they are following for what is the MIME type of a JPEG, PNG, etc. So you'd have to predict every possible MIME type that a browser *might* send for any given file type, and there's no predicting IE, for starters. It would be nice if the browsers provided standardized info, as this would be one more hurdle to put in the way of errors, but as it stands now, I'd avoid bothering with it. Too much hassle for too little payoff. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php