Re: PHP to get File Type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>   function get_file_extension($file) {

http://us2.php.net/manual/en/function.pathinfo.php

<?php
$path_parts = pathinfo('/www/htdocs/index.html');

echo $path_parts['dirname'], "\n";
echo $path_parts['basename'], "\n";
echo $path_parts['extension'], "\n";
echo $path_parts['filename'], "\n"; // since PHP 5.2.0
?>

Secondly the MIME type can differ from the extension (file suffix)
It's the same with uploaded files. Although the browser sends the MIME
type it might not be the right one, since browsers obtain the MIME by
checking the extension.

//A yeti

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux