file_exists

They have: 164 posts

Joined: Nov 2001

i have a if statement...

<?php
if (file_exists(DIR_FS_DOWNLOAD . $downloads_values['orders_products_filename']))
echo \
"123\";
else
echo \"abc\";
?>

it is to check whether the file exists for download or not..
i keep getting abc as result although my file is exists...wat could be wrong? pls help...

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Could you give us the values of DIR_FS_DOWNLOAD and $downloads_values['orders_products_filename'] ?

The path could be wrong, or some part of the filename (including it's extension) could be missing. You may also need delimiters (/'s) in the path. Smiling

Busy's picture

He has: 6,151 posts

Joined: May 2001

would [$orders_products_filename] work instead of ['orders_products_filename'] ?

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

That would depend if the string (orders_products_filename) is the key, or if it's a variable holding the key.

They have: 447 posts

Joined: Oct 1999

do this:

<?php
$file
= DIR_FS_DOWNLOAD . $downloads_values['orders_products_filename']
if (
file_exists($file))
echo \
"123\";
else
echo \"doesnt exist:
$file\";
?>

that way you'll know exactly which file doesn't exist, my guess is it really doesnt exist possibly because of a missing '/'

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.