Jump to content

[SOLVED] file_exists Function Help


ballouta

Recommended Posts

Hello

 

I am trying to check if an inserted name for a directory exists or not.

I wrote:

<?php
$gname = $_POST['name'];	
$filename = '/home/farid/public_html/images/galleries/$gname';

if (file_exists($filename)) {
    echo "The file $filename exists";
} else {
    echo "The file $filename does not exist";
}

?>

 

I already created a folder in this location:

images/galleries/ballouta

 

but the output is:

The file /home/farid/public_html/images/galleries/$gname does not exist

 

where is the problem?

Please help

thank you

Link to comment
https://forums.phpfreaks.com/topic/156160-solved-file_exists-function-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.