0

I need one help.I need to search the image is present inside the folder or not by image name using PHP. I am explaining my code below.

$imagepath=http://localhost/koolfeedbackdev/admin/uploads/

$name=1ttb4wes4_MedRes_Product-presentation-2.jpg

i did like below but its not working.

$vimage="1ttb4wes4_MedRes_Product-presentation-2.jpg";
    if (file_exists("http://localhost/koolfeedbackdev/admin/uploads/".$vimage)){
       // $data['logo'] = empty($v["image2"]) ? "0" : $path . $v["image2"];
        echo 'yes';
    }else{
        echo 'no';
    }

Here i need the above image is present that particular path or not. Please help me.

1 Answers1

0

file_exists() needs to use a file path on the hard drive, not a URL. So you should have something more like:

<?php
$vimage="callbg.png";
    if (file_exists(dirname(__FILE__)."/images/".$vimage)){

        echo 'yes';
    }else{
        echo dirname(__FILE__);
    }
?>
SameerKhan1406
  • 289
  • 5
  • 18