filetype

(PHP 3, PHP 4 , PHP 5)

filetype -- Obtiene el tipo de archivo

Descripción

string filetype ( string nombre_archivo)

Devuelve el tipo del archivo. Los posibles valores son fifo, char, dir, block, link, file, y unknown.

Devuelve FALSE si ocurre un error. filetype() producirá siempre un mensaje E_NOTICE si el llamado a stat falla o el tipo de archivo es desconocido.

Nota: Los resultados de esta función son guardados. Consultar clearstatcache() para más detalles.

Sugerencia: As of PHP 5.0.0 this function can also be used with some URL wrappers. Refer to Apéndice L for a listing of which wrappers support stat() family of functionality.

Ejemplo 1. Ejemplo de filetype()

<?php

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

?>

Vea también is_dir(), is_file(), is_link(), file_exists(), stat(), y mime_content_type().