Autor Zpráva
paja_e99
Profil *
Na localhostu (php 5.2.5) chci zjsitit typ souboru pomoci mime_content_type,
ten
ale vzdy vypise:
Warning: mime_content_type() [http://www.php.net/mime_magic]: mime_magic
not initialized in...


pritom v php.ini mam odkomentovane
extension=php_mime_magic.dll


a v modulech nastavene
[mime_magic]
mime_magic.debug = On
mime_magic.magicfile = "_CESTA_K_PHP\extras\magic.mime"


(mam Win XP)

podle diskuze na php.net jsem zkusil ziskat typ i pres fileinfo:
$finfo = finfo_open(FILEINFO_MIME);
$typ = finfo_file($finfo, "files/".$_GET["file"]);
finfo_close($finfo);
echo $typ;


ale skript vyhodi:
Warning: finfo_open() [function.finfo-open]: Failed to load magic database
at '(null)'. in ...
majster_sveta
Profil
Toto mi pomohlo, v tom istom probleme:

Thank you all. Following your instructions, here is what i did get it
work:

1. Go to http://pecl4win.php.net/list.php to get php_fileinfo.dll and
have this dll declared in php.ini (extension=php_mime_magic.dll)

2. Go to
http://sourceforge.net/project/showfiles.php?group_id=23617&package_id =18878
, extract the downloaded file. Look for files "magic" and
"magic.mime" and have them under php extras directory. (Note: php.2.5
magic.mime gave wrong mime type).

3. My script looks like:

$handle = finfo_open(FILEINFO_MIME,'c:\php52\extras\magic');
$mime_type = finfo_file($handle,$file);

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: