File exists always returning false

Alimon Karim

My image directory is \webroot\files\thumbs

I am trying to add file_exists condition. For that I tried bellow code

$file = WWW_ROOT .'files' . DS . 'thumbs' . DS .'_'.$password->collection_id.'jpg';

$file_exists = file_exists($file);

It's always returning zero.

If I echo $file it's giving me output like this

c:\xampp\htdocs\myproject\files\thumbs\_61.jpg
BenM

You're missing the . before the extension. Update your $file definition as follows:

$file = WWW_ROOT .'files' . DS . 'thumbs' . DS .'_'.$password->collection_id.'.jpg';
                                                       // This was missing ---^

$file_exists = file_exists($file);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Directory.Exists() always returning false?

From Dev

Check if AlarmManager exists always returning false

From Dev

Why is file_exists() returning false?

From Dev

IO.File.Exists() always returns false

From Dev

File.Exists() always returns false

From Dev

Check if file exists or not? file.exists() return always false

From Dev

curl always returning false

From Dev

function always returning false

From Dev

if condition always returning False

From Dev

if statement always returning false

From Dev

c# FileInfo exists returning false for network path to file

From Dev

My file exists though fileExistsAtPath always returns false

From Dev

If file is exists and is not empty. Always gives me the false value

From Dev

My file exists though fileExistsAtPath always returns false

From Dev

FileUploader.Has File always returning false in .net 4.0

From Dev

method_exists returning false

From Dev

lastInsertId always returning FALSE in PostgreSQL

From Dev

Modulus in Ruby always returning false

From Dev

PHP function always returning false

From Dev

Batch IF statement always returning false?

From Dev

Why is typeid always returning false?

From Dev

My resultset is always returning false

From Dev

Always returning false | Javascript | objects

From Dev

If statement in C always returning false

From Dev

Always returning false as boolean value

From Dev

File.Exists(Path) always return false when get 'string (Path)' from text file

From Dev

If File Exist is always false

From Dev

Why is IsNewRow property always returning false?

From Dev

Jasmine date expect always returning false