file_exists
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 posted this at 07:18 — 8th February 2002.
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.
Busy posted this at 21:51 — 8th February 2002.
He has: 6,151 posts
Joined: May 2001
would [$orders_products_filename] work instead of ['orders_products_filename'] ?
Mark Hensler posted this at 23:25 — 8th February 2002.
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.
ROB posted this at 22:46 — 10th February 2002.
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.