I'm using PHP 4.4.4-8 on Debian Linux on a low traffic site, and need
to detect if a file exists, and if so, unlink it.
I am mystified as to why the file_exists() function does not work in
one particular section of code, yet does work in another section. The
unlink() function similarly works in one section, but not the other.
I have read other posts in this group where others have had trouble
with the file_exists() function, but none seemed to help with my
problem; so here goes...
Here is the code snippet that does not work, which includes a test to
verify if 'safe mode' is off:
if ($debug) {
echo "<br>fullname of target file = ".$fullname;
echo "<br>File exists? ";
if (file_exists($fullname)) {
echo "YES!";
} else {
echo "NO!!";
}
echo "<br>Safe mode on? ";
if (ini_get('safe_mode')) {
echo "YES!";
} else {
echo "NO!!";
}
echo "<br>(exiting...)";
exit;
Here is the (partial) output:
fullname of target file = /Net/delta/home/ehringer/MAELab/RickLIMStest/
GABA_JSakai/GABRGI/rs10033451/caller_1_results/
GABRGI_rs10033451_080307_VS_cda01_cda02_cda03_cda0 4.txt
File exists? NO!!
Safe mode on? NO!!
(exiting...)
By cut-&-paste into a console window with ls -la command, I verify the
full pathname is correct.
If anyone has any ideas about this, I would be most grateful...
Thanks,
Rick Casey