Jump to content

Archived

This topic is now archived and is closed to further replies.

ibanez270dx

[resolved] Check if a file exists...

Recommended Posts

Hi,
How do I check if a file exists on my server? I am currently using an if($filename2) where the $filename2 is thename.xls (the files are located in the same directory). This doesn't seem to work... it just automatically goes to the statement afterward even if the file doesn't exist. Someone please help!

Thanks,
- Jeff

Share this post


Link to post
Share on other sites
if(file_exists($filename2))

::EDIT::
http://us3.php.net/file_exists

Share this post


Link to post
Share on other sites
Php manual example:

[code]<?php
$filename = '/path/to/foo.txt';

if (file_exists($filename)) {
  echo "The file $filename exists";
} else {
  echo "The file $filename does not exist";
}
?> [/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.