★ wanayoo — archive 1999 http://www.php.net/manual/function.filetype.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Filesystem
Quick Reference
German version of this pageJapanese version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
Filesystem
* basename
* chgrp
* chmod
* chown
* clearstatcache
* copy
* delete
* dirname
* diskfreespace
* fclose
* feof
* fgetc
* fgetcsv
* fgets
* fgetss
* file
* file_exists
* fileatime
* filectime
* filegroup
* fileinode
* filemtime
* fileowner
* fileperms
* filesize
* filetype
* flock
* fopen
* fpassthru
* fputs
* fread
* fscanf
* fseek
* fstat
* ftell
* ftruncate
* fwrite
* set_file_buffer
* is_dir
* is_executable
* is_file
* is_link
* is_readable
* is_writeable
* link
* linkinfo
* mkdir
* pclose
* popen
* readfile
* readlink
* rename
* rewind
* rmdir
* stat
* lstat
* realpath
* symlink
* tempnam
* touch
* umask
* unlink
Manual: filetype
View the source code for this pageSearch the site



Previous page
 filesize
 Updated
Sat, 12 Aug 2000
flock 
Next page


filetype

(PHP3 , PHP4 )

filetype -- Get file type

Description

string filetype (string filename)

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

Returns false if an error occurs.

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


User Contributed Notes: filetype


jake@wtcbt.com
24-Jun-1999 06:24
why do i keep getting errors with this function? the funny thing is that it doesn't generate error when the page containing the function is opened the first time, but when it calls itself with modified params, it generates an error. and I can't determine the file type thereafter.


phpdude@yahoo.com
26-Aug-1999 09:34
I noticed that it only works if you chdir to the directory that contains the file first. Could be NT specific...


billgr@optics.caltech.edu
18-Jan-2000 09:09
No, you must chdir to the directory for it to work consistently. Interestingly, it returned correctly for the file "index.php3" in another directory, but none of the rest of the files.


justin@openup.com
07-Apr-2000 12:02
If you are looking instead to find out the mime-type of a file (assuming you already know it's of type 'file') then the best way I've found is to use the 'file' command in a system call (on *NIX anyway). However, I have found a shortcut in case you need to know whether an image is a GIF, JPEG, or PNG: use the <B>GetImageSize</B> function which returns as one of its array elements the type of image.


 About Notes


Previous page
 filesize
 Updated
Sat, 12 Aug 2000
flock 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.