Solved

What wrong with file_exists for Hidden file ?

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
The viewer will learn how to dynamically set the form action using jQuery.
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now