Problem with unlink() in php!

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

      $max_width  = 120;
      $max_height = 72;
        $path ="/home/fff99/public_html/temp/";
        $nname = "/home/friend99/public_html/temp/".$imgname;
        $fileo = fopen($nname,"rb");
            $imgData = addslashes(file_get_contents($nname));


You should check the return value from unlink to 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:

    echo "AAAAH!";

I had a similar problem using @unlink it would pick and choose when to delete, so I switched to this;

if (file_exists($filename)) {

for some reason that worked for me, hope it helps.

Need Your Help

View hides during animation

android animation

I have a xml-layout that consists two FrameLayouts(f1 and f2). F1 fills all screen's area, and f2 is hided under the screen by using android:layout_marginBottom="-900dp".

What are the IPC mechanisms available in the Android OS?

android android-intent ipc android-bundle android-binder

Will any one please tell me what are all the IPC mechanisms that are present in Android.