FINFO(3) 1 FINFO(3)The finfo classINTRODUCTION
This class provides an object oriented interface into the fileinfo functions.
CLASS SYNOPSIS
finfo
finfo
o public finfo::__construct NULL ([int $options = FILEINFO_NONE], [string $magic_file])
o public string finfo::buffer NULL NULL (string $string, [int $options = FILEINFO_NONE], [resource $context])
o public string finfo::file NULL NULL (string $file_name, [int $options = FILEINFO_NONE], [resource $context])
o public bool finfo::set_flags (int $options)
PHP Documentation Group FINFO(3)
Check Out this Related Man Page
FINFO_OPEN(3) 1 FINFO_OPEN(3)finfo_open - Create a new fileinfo resource
Procedural style
SYNOPSIS
resource finfo_open NULL ([int $options = FILEINFO_NONE], [string $magic_file])
DESCRIPTION
Object oriented style (constructor): finfo::__construct NULL ([int $options = FILEINFO_NONE], [string $magic_file])
This function opens a magic database and returns its resource.
PARAMETERS
o $options
- One or disjunction of more Fileinfo constants.
o $magic_file
- Name of a magic database file, usually something like /path/to/magic.mime. If not specified, the MAGIC environment variable is
used. If the environment variable isn't set, then PHP's bundled magic database will be used. Passing NULL or an empty string will
be equivalent to the default value.
RETURN VALUES
(Procedural style only) Returns a magic database resource on success or FALSE on failure.
NOTES
Warning
The expected magic database format changed in PHP 5.3.11 and 5.4.1. Due to this, the internal magic database was upgraded. This
mostly effects code where an external magic database is used: reading an older magic file will now fail. Also, some textual repre-
sentations of the mime types has changed, for instance for PHP would be "PHP script, ASCII text" instead of "PHP script text"
returned.
Note
Generally, using the bundled magic database (by leaving $magic_file and the MAGIC environment variables unset) is the best course
of action unless you specifically need a custom magic database.
EXAMPLES
Example #1
Object oriented style
<?php
$finfo = new finfo(FILEINFO_MIME, "/usr/share/misc/magic"); // return mime type ala mimetype extension
/* get mime-type for a specific file */
$filename = "/usr/local/something.txt";
echo $finfo->file($filename);
?>
Example #2
Procedural style
<?php
$finfo = finfo_open(FILEINFO_MIME, "/usr/share/misc/magic"); // return mime type ala mimetype extension
if (!$finfo) {
echo "Opening fileinfo database failed";
exit();
}
/* get mime-type for a specific file */
$filename = "/usr/local/something.txt";
echo finfo_file($finfo, $filename);
/* close connection */
finfo_close($finfo);
?>
The above example will output:
text/plain; charset=us-ascii
SEE ALSO finfo_close(3).
PHP Documentation Group FINFO_OPEN(3)
Hi:
I am trying to read mails using pop3 protocol with the nail client. I have configurated the following files:
.mailrc
set NAIL_EXTRA_RC=~/.nailrc
.nailrc
shortcut myisp pop3://developers@afinformatica.com@mail.afinformatica.com
set... (2 Replies)
Right, noob to shell scripting, playing a round for practice, wrote the following but it doesn't seem to work as expected, how could I fix/improve this script?
#!/bin/bash
#set -v
#set -x
case $# in
1)
echo Searching for $1 in '*';
find . -iname '*' 2>/dev/null | xargs grep "$1" -sl... (3 Replies)
I am trying to print file information using ffmpeg tool in perl
Here is my code
use strict;
use warnings;
use IPC::Open3;
# example
my $filename = $ARGV;
my %videoInfo = videoInfo($filename);
print "duration: " . $videoInfo{'duration'} . "\n";
print "durationsecs: " .... (0 Replies)
Hi
I have a perl script that prints all the video and audio file information(playing duration).
It works fine in one of my friends linux laptop.
But it doesn't work in my both windows and linux.
My friend told me I have to do install some module ( ppm instal ...... )
but I have no... (1 Reply)
Hi,
I am new to using readline library to my application. Please I want to no how to write code for command line switches(options), i.e when i press tab the option of command as to change.
eg:
ls -a
ls -d
...so on ls as many options, here i want options to be completed using tab
... (9 Replies)
Upon opening Terminal I get the following message:
-bash: /usr/bin/manpath: No such file or directory
-bash: /usr/bin/perl: No such file or directory
-bash: grep: command not found
-bash: grep: command not found
-bash: grep: command not found
-bash: grep: command not found
I searched... (9 Replies)
Hi ,
In a server /tmp has almost reached 75% and i can see the File system utilization is 48Mb only , so i believe some process is using the /tmp space. I would like to know which process is using /tmp space.
# df -h /tmp
Filesystem size used avail capacity Mounted on
swap ... (9 Replies)
I'm trying to list all open sockets and their PIDs on Solaris 10 in C++.
In Solaris 11, they made this really simple by adding the PID to the mib structs (example, tcpConnCreationProcess in inet/mib2.h). This functionality isn't in Solaris 10, and can be seen in the new netstat source code.
... (1 Reply)
Hi Team,
I have created attached script in mysql environment. But there is below error .
can you please suggest .
Error : Unknown table 'processlist' in finformation_schema
#!/bin/bash
mysql -u $DBUSER -p$DBPASS -e "
select
-- *
id
from information_schema.processlist
where... (1 Reply)
Just added OSX 10.14 Mojave Commands (currently over 13K pages in the mojave repo) to our man page repository:
OSX 10.14 Mojave Commands
We need to update all the man pages to the most current versions, so please contribute man page sets to your favorite OS environment (tar.gz with os and... (3 Replies)