Solved

What wrong with file_exists for Hidden file ?

Posted on 2009-05-06
4
338 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
website maintenance mode 1 25
PHP Query return divisible by 3 3 26
How do I fix this UPDATE error? 7 32
Delete  php pages of a part of our site 8 31
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

860 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