Solved

What wrong with file_exists for Hidden file ?

Posted on 2009-05-06
4
346 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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.  …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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 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…

734 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