Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mime_content_type(3) [php man page]

MIME_CONTENT_TYPE(3)							 1						      MIME_CONTENT_TYPE(3)

mime_content_type - Detect MIME Content-type for a file (deprecated)

SYNOPSIS
string mime_content_type (string $filename) DESCRIPTION
Returns the MIME content type for a file as determined by using information from the magic.mime file. PARAMETERS
o $filename - Path to the tested file. RETURN VALUES
Returns the content type in MIME format, like text/plain or application/octet-stream. NOTES
Warning This function has been deprecated as the PECL extension Fileinfo provides the same functionality (and more) in a much cleaner way. EXAMPLES
Example #1 mime_content_type(3) Example <?php echo mime_content_type('php.gif') . " "; echo mime_content_type('test.php'); ?> The above example will output: image/gif text/plain SEE ALSO
Fileinfo for a replacement . PHP Documentation Group MIME_CONTENT_TYPE(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)
Man Page

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to attach a file in mail?

Hi, I want to know how to send a mail in unix using mailx or mail or sendmail to send a mail with a file attached. I have read the answers from the other threads but I still don't understand. I want to do it in the command line as well as in script. Can anyone help? DO I need to use... (1 Reply)
Discussion started by: firebirdonfire
1 Replies

2. Programming

metamail execution error

Hi. I´m have installed the metamail from skunkware and when I´m trying to use mailto (the complete script is bellow), I got this message: # mailto To: test@bla.com Subject: test ~/2048000 Set splitsize to 2048000 ~* Please choose which kind of data you wish to insert: 0: A raw file,... (2 Replies)
Discussion started by: ahnishimi
2 Replies

3. UNIX for Advanced & Expert Users

Mail attatchment line length

Hello, I run a shell script to send an email with an attatchment by using metasend: STAGEDIR=/live/data MAILTO=brown_b@matalan.co.uk MAILCC=brown_b@matalan.co.uk #-------------------------------------------- SUBJECT='Matalan - Intrastat Report File' ... (5 Replies)
Discussion started by: brown_b
5 Replies

4. Shell Programming and Scripting

mail from unix

hi i looked at different threads on how to send mail from unix. but i want to ask how can i send mail when my unix server is only connected to mail server this i know cause i can ping it to that server. how can send mail with help of that mail server ? i do have mail id on that server. i know... (6 Replies)
Discussion started by: zedex
6 Replies

5. Shell Programming and Scripting

Retrieving File's Mime-type

Alright, so I am trying to use perl (or any other shell scripting language, awk/sed/bash for instance), to retrieve the mime-type of a file. I want to keep it in one file, and most of the modules that are on cpan that check for mime types (Magic), aren't installed on these boxes. Anyone have... (2 Replies)
Discussion started by: Rhije
2 Replies

6. IP Networking

Using Squid in Windows XP Getting Error can't open website

I have installed Squid squid-2.7.STABLE8-bin in Windows XP in Vmware Workstation .. i have installed it in C Drive And followed the steps mentioned below now squid is running .. the changes i have made to my squid file is Step i followed My Squid.conf File Configuration is here... (0 Replies)
Discussion started by: babinlonston
0 Replies