PHP: finfo_open - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

finfo_set_flags finfo_file

Last updated: Fri, 26 Jan 2007

view this page in

# finfo_open

(PECL)

finfo_open -- Create a new fileinfo resource

## Описание

resource finfo_open ( [int options [, string arg]] )
class finfo {
__construct ( [int options [, string magic_file]] )
}

This function opens a magic database and returns its resource.

## Список параметров

`options`

  One or disjunction of more Fileinfo constants.

`magic_file`

  Name of a magic database file, usually something like `/path/to/magic.mime`. If not specified, `MAGIC` environment variable is used. If this variable is not set neither, `/usr/share/misc/magic` is used. `.mime` and/or `.mgc` is added if appropriate.

## Возвращаемые значения

Returns a magic database resource on success or `FALSE` on failure.

## Смотрите также

finfo_close()

add a note User Contributed Notes
finfo_open
a at b dot c dot de
26-Oct-2006 01:14
`To elaborate on the previous note, it isn't necessary to delete every line that contains a '!' for the Windows version of the extension to work - only those that specify a magic string starting with '!' (e.g., !<arch>...., !SCREAM!).`
18-Oct-2006 02:09
`>I found on windows that it would always return the type as “application/x-dpkg”.
You can fix file magic.mime.
Remove strings with "!"`
jmdault at revolutionlinux dot com
18-Aug-2006 09:32
`Just to make it even clearer: you need to omit the file extension.
If your magic file is /usr/share/misc/file/magic.mime, you need to call finfo_open with "/usr/share/misc/file/magic".`
EvilPuppetMaster
03-May-2006 11:21
`Just to make it clear, the 'magic' file should already exist in your php folder in the directory /extras/magic.mime
I found on windows that it would always return the type as “application/x-dpkg”. Not sure why that is but thanks to Ecosmear (http://link.toolbot.com/ecosmear.com/15073) I learned that you can fix this by using the magic file supplied in GnuWin32 (http://link.toolbot.com/sourceforge.net/15074).`
add a note
finfo_set_flags finfo_file

Last updated: Fri, 26 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 09:32:46 2007 PST