downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

flock> <filesize
Last updated: Wed, 22 Jul 2009

view this page in

filetype

(PHP 4, PHP 5)

filetype — Leest het type van een bestand uit

Beschrijving

string filetype ( string $filename )

Geeft het type van het bestand terug. Mogelijke waardes zijn fifo, char, dir, block, link, file en unknown.

Geeft FALSE terug in het geval van een fout. filetype() zal ook een E_NOTICE bericht produceren als de stats aanroep faalt of als het bestands type onbekend is.

Note: The results of this function are cached. See clearstatcache() for more details.

Note: This function will not work on remote files as the file to be examined must be accessible via the servers filesystem.

Example#1 filetype() voorbeeld

<?php

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

?>

Zie ook is_dir(), is_file(), is_link(), file_exists(), stat() en mime_content_type().



add a note add a note User Contributed Notes
filetype
7r6ivyeo at mail dot com
22-Nov-2008 02:29
I use the CLI version of PHP on Windows Vista.  Here's how to determine if a file is marked "hidden" by NTFS:

<?php
function is_hidden_file($fn) {

   
$attr = trim(exec('FOR %A IN ("'.$fn.'") DO @ECHO %~aA'));

    if(
$attr[3] === 'h')
        return
true;

    return
false;
}
?>

Changing <?php if($attr[3] === 'h') ?> to <?php if($attr[4] === 's') ?> will check for system files.

This should work on any Windows OS that provides DOS shell commands.
ruach at chpc dot utah dot edu
11-Mar-2004 02:11
There are 7 values that can be returned. Here is a list of them and what each one means

block: block special device

char: character special device

dir: directory

fifo: FIFO (named pipe)

file: regular file

link: symbolic link

unknown: unknown file type

flock> <filesize
Last updated: Wed, 22 Jul 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites