filetype

(PHP 4, PHP 5, PHP 7)
Gets file type
string filetype ( string $filename )

Returns the type of the given file.

Parameters:
filename

Path to the file.

Returns:

Returns the type of the file. Possible values are fifo, char, dir, block, link, file, socket and unknown.

Returns FALSE if an error occurs. filetype() will also produce an E_NOTICE message if the stat call fails or if the file type is unknown.

Exception:

Upon failure, an E_WARNING is emitted.

Notes:
The results of this function are cached. See clearstatcache() for more details.
Examples:
filetype() example
<?php

echo filetype('/etc/passwd');  // file
echo filetype('/etc/');        // dir

?>

See also:

is_dir() -

is_file() -

is_link() -

file_exists() -

mime_content_type() -

pathinfo() -

stat() -

doc_php
2016-02-24 15:56:50
Comments
Leave a Comment

Please login to continue.