If you are trying to get the extension of the file. I have the following piece of code for you:
<?php
$extension = substr($file_name, strrpos($file_name, "."));
// That code must get the correctly extension in any cases.
?>
![]() |
|
||||||||||
|
is_fileОписаниеbool is_file ( string filename )Возвращает TRUE, если файл существует и является обычным файлом.
is_file
Guilherme guilherme at gmail dot com
16-Jul-2007 06:36
If you are trying to get the extension of the file. I have the following piece of code for you:
cristian dot ban at neobytesolutions com
27-Jun-2007 01:46
regarding note from rehfeld dot us :
riki1512 / a_t / gmx / d_ot / de
07-Feb-2007 03:22
Be careful with big files. I get a
tatarynowicz at gmail dot com
17-Oct-2006 07:35
An easy way not to have to choose between hard-coding full paths and using relative paths is either via this line:
SimonCharest at gmail dot com
08-Aug-2006 10:39
In rlh's example, "$ext=explode('.',$document);" is only good if you consider that the filename only possesses a single dot (".") and that it is right before the extension. You should get the last dot's position with the strRPos() function instead.
Emin Sadykhov (azdg_nospam at azdg dot com)
12-Dec-2005 05:57
File operations such as is_file (also is_dir, opendir, readdir) work slower with Absolute paths - processing time is increase in 2-3 times.
Jonathan Shaltz
14-Oct-2005 10:23
Maybe this is a newbie mistake, but note that paths are relative to the filesystem and the location of the script. This means that MS IIS virtual directories are not available by relative path - use an absolute.
bill fumerola
30-Aug-2005 06:45
be careful, is_file() fails on files larger than your integer storage (2^32 for most).
punknroll at gmx dot at
11-Aug-2005 08:11
is_file returns false if you don't have the permissions for the file or the directory (eg.: you are web34 and the directory belongs to root)!
08-Mar-2005 09:02
### Symbolic links are resolved ###
ludvig dot ericson at gmail dot com
25-Oct-2004 11:06
I tend to use alot of includes, and I found that the is_file is based on the script executed, not ran.
rehfeld.us
03-Sep-2004 03:04
regarding rlh at d8acom dot com method,
rlh at d8acom dot com
12-Feb-2003 05:17
I do a lot of file parsing and have found the following technique extremely useful:
andreas dot stagl at fits dot at
27-Mar-2002 11:34
if you're running apache as a service on a win32 machine, an you try to determinate if a file on an other pc in your network exists - ex.: is_file('//servername/share/dir1/dir2/file.txt') - you may return false when you're running the service as LocalSystem. To avoid this, you have to start the Apache-Service as a 'registered' domain user.
quietust at ircN dot org
13-Dec-2001 08:20
In PHP 4.1.0 under win32, this seems to print out a warning message if the file does not exist (using error_reporting = E_ALL & ~E_NOTICE).
amraam at ao dot net
11-Mar-2000 06:56
It seems that is_file doesn't return true for a file that is 0 bytes. Perhaps it is something with the file system. I am using IIS 3.0 on an NT4 box. I worked around it using !is_dir($filename) but that seems a clunky way to do it.
|