Solved

What wrong with file_exists for Hidden file ?

Posted on 2009-05-06
4
336 Views
Last Modified: 2012-08-14
I have a hidden file '/var/tmp/.a'

<?php
$file1='/var/tmp/.a';
echo $file1."<br>";
if (file_exists($file1))
{

      echo "File exist";
}
else
      echo "File not exist";
?>

file_exists allway show "File not exist" with hidden file?

How to resolve problem?

Thanks!
0
Comment
Question by:laptop1vn
4 Comments
 
LVL 2

Accepted Solution

by:
danls earned 125 total points
ID: 24321708
As per this post:

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_22715923.html

Could you check that PHP has permissions to read the file?
Are you sure you are pointing to the correct directory?
Try opening and displaying the file (for example using file_get_contents() ). If it doesn't work it may be a permissions or path issue.

Regards,

D
0
 
LVL 4

Expert Comment

by:aconrad
ID: 24321713
file_exists
This function returns FALSE for files inaccessible due to safe mode restrictions.

is file accessible by php ?
0
 
LVL 2

Expert Comment

by:lavinpj1
ID: 24321721
Which PHP ver are you using? Works here on 5.2.6.

phil@phil:~$ php hidden.php
File not exist
phil@phil:~$ touch .abc
phil@phil:~$ php hidden.php
File exist
phil@phil:~$

Phil
0
 

Author Closing Comment

by:laptop1vn
ID: 31578830
I have a mistake, because the folder which contain the file is right: 700, not 755
Thanks!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question