I’m creating a temp image always named 1.png under specific folder and once i read the image_contents and process, i use unlink() to delete that specific image from that folder.
But sometimes the image file is not deleted and the same image is file is read and processed.
That script is working otherwise fine…
There is no permission related issues , as the files are deleted sometimes…
Will there be any issue when the script is repeatedly called and the image with the name is already present and not deleted etc.. ???
Please suggest me what would be the problem
extension_loaded('ffmpeg');
$max_width = 120;
$max_height = 72;
$path ="/home/fff99/public_html/temp/";
.....
.....
$nname = "/home/friend99/public_html/temp/".$imgname;
$fileo = fopen($nname,"rb");
if($fileo)
{
$imgData = addslashes(file_get_contents($nname));
....
...
..
}
unlink('$nname');
You should check the return value from
unlinkto see if it’s returning false. Most likely the problem is an open file handle preventing unlink from completing; your fopen should have a corresponding fclose: