Re: detect if file exist

From: Date: Sun, 21 May 2006 15:55:50 +0000
Subject: Re: detect if file exist
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-236575@lists.php.net to get a copy of this message
On 5/21/06, Alain Roger <raf.news@gmail.com> wrote:
i have 1 folder, in this folder sometime a file can be sometimes not... 1. i would like to detect if the folder contains a file or not. only 1 file can be in this folder but i do not know the name of this file, and the extension should be xls.
Use the glob function: php.net/glob. Something like: $f = glob('*.xls'); if ( count($f) ) $file = $f[0]; else die('no file'); Rabin

« previous php.general (#236575) next »