Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

What wrong with file_exists for Hidden file ?

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
laptop1vn
Asked:
laptop1vn
1 Solution
 
danlsCommented:
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
 
aconradCommented:
file_exists
This function returns FALSE for files inaccessible due to safe mode restrictions.

is file accessible by php ?
0
 
lavinpj1Commented:
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
 
laptop1vnAuthor Commented:
I have a mistake, because the folder which contain the file is right: 700, not 755
Thanks!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now