On Wed, 07 Jan 2004 19:07:46 +0000, Matthew Robinson wrote:
is there a way to check if a file exists using php? i want to check if a
picture exists, and if not, use a picture saying that the picture couldn't
be found.
TIA
I've been using something along the lines of this:
$filename=($dbrow['hexid'] . ".jpg");
if (file_exists($filename))
{
printf("<img src=\"%s.jpg\" alt=\"%s\" />\n<br />", $dbrow["id"],
$dbrow["name"]);
}
else
{
printf("<img src=\"notfound.jpg\" alt=\"no image available\" />\n<br />");
}
Which is probably not a very elegant way of doing things, but it 'works
for me(tm)'.