You are here: Re: php fileinfo help needed « PHP Programming Language « IT news, forums, messages
Re: php fileinfo help needed

Posted by _q_u_a_m_i_s's on 01/22/08 10:42

On Jan 22, 11:36 am, bob <lun...@gmail.com> wrote:
> I am having trouble getting the PHP PECL fileinfo component to work. I
> am using Cakephp 1.2, XAMPP in WIndows Vista environment.
>
> I have the following code:
> $file = "C:\xampp\htdocs\app\webroot\pics\file.jpg";
>
> $handle = finfo_open(FILEINFO_COMPRESS,'c:/magic');//
> FILEINFO_COMPRESS,"c:/magic");
> if (!$handle) {
> echo "Opening fileinfo database failed";
>
> }
>
> $mime_type = finfo_file($handle,$file);
>
> I get the following output:
> Opening fileinfo database failed
> Warning (2): finfo_file(): supplied argument is not a valid file_info
> resource [APP\controllers\users_controller.php, line 198]
>
> I put the magic.mime file in the C:\ directory. I also added the
> extension=php_fileinfo.dll line in the php.ini file.
>
> Thanks in advance

I`m not sure how its on windows..but 'c:/magic' ?? shouldn`t it be 'c:
\magic'? From what i see here, $handle is either false, or null.
Either case $handle should be a resource id, not null.

From the manual:
"A .mime and/or .mgc suffix is added if needed."


Return Values
Returns a magic database resource on success or FALSE on
failure. ..... so your call to finfo_open failed:)

 

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

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