i have got a very crazy! problem

i am trying to erase an image from e web page

iwrote this piece of code to show the image and the bullet for the uset to delete


$files1 = scandir($dir2);

foreach ($files1 as $value)
    if ((substr($value, -3)==="jpg") or (substr($value, -3)==="JPG") or (substr($value, -3)==="gif") or (substr($value, -3)==="GIF") or (substr($value, -3)==="png") or (substr($value, -3)==="PNG"))
     <img src="../../random/images2/<?php echo $value;?>"  width="200" height="150" alt="some_text">
       echo "
            <form action='delete.php' method='post'>
           <input type='hidden' name='Name2' value='$value'>
           <input type='hidden' name='absolute_path' value='$absolute_path'>
           <input type='submit' value='Delete'>


the delete.php


if ($Name2)
echo "in 2<br>";
     $PathFIle = strval (trim($PathFIle));
   echo $PathFIle;
   echo "<br>";
   if (file_exists('$PathFIle'))

the message i get is that file doesnt exists. The file surely exists. note that i ve taken the echo result of my browser and i replaced the code like that

 if (file_exists('../../random/images2/apagk.jpg'))

and it worked perfectly.....

what is going on the $PathFIle contains the '../../random/images2/apagk.jpg' butthe file exists and thw unlink doesnt recornize it...

any ideas???

PHP is case sensitive, the variable in the unlink is one letter off.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.