Re: file_exists problems

From: Date: Sat, 01 Dec 2001 19:26:55 +0000
Subject: Re: file_exists problems
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-76320@lists.php.net to get a copy of this message
file_exists takes a string argument. /images/$filename is not a string. try "images/" . $filename instead. Fred Prolog <13speed@excite.com> wrote in message news:20011201070835.36430.qmail@pb1.pair.com... > I had a script that was running beautiful that simply called up a database > and displayed the results in tables. I went to add images to this script > and all hell broke loose. This is the portion of the script that I added: > > > ---------- > > file://filename is the item number + t.jpg -- t shorthand for thumbnail > > $itemnumber = "$myrow[item_number]"; > $filename = "$itemnumber t.jpg"; > > echo "<tr><td><center>"; > > file://if the file exists then print it. Otherwise print a generic image saying > it doesn't exist. > > if(file_exists(/images/$filename)) > { > readfile(/images/$filename); > } > else > { > readfile(images/npat.jpg); > } > > --------- > > Is there anything I need to know about "file_exists" that I'm not doing. > for some reason when this code is added it gives me an error on the line > after the close of the else statement. That line was perfectly fine before > the addition. Please help. > > -Jordan > >

« previous php.general (#76320) next »