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

pritom v php.ini mam odkomentovane

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

(mam Win XP)

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

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

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

1. Go to to get php_fileinfo.dll and
have this dll declared in php.ini (extension=php_mime_magic.dll)

2. Go to =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: