You are here: Re: [PHP] filtering uploaded files « PHP « IT news, forums, messages
Re: [PHP] filtering uploaded files

Posted by Marek Kilimajer on 10/21/03 11:12

Angelo Zanetti wrote:
> hi Richard this sounds like quite a serious subject but is there no
> other way to check the validity of the file and type without using the
> unix command?
>
> IE using PHP and not depending on system commands? thanks for your
> insight so far, very important.

The equivalent of `file` command is mime_content_type() php function (if
enabled). Other alternatives are to use fgetcsv() to check if the file
is a csv file, imagesize() to check for image files, and similar.

But you can never be 100% sure the file is completely valid without
checking the whole file. For example mime_content_type() and imagesize()
check only first few bytes, but the rest of the file might be junk.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация