Domanda

What I am trying to do is delete up one level in a new folder in PHP.

I hear the function I want to use is 'unlink'. I'm not 100% whether I am using this correctly. The script I am editing is in /includes/scriptname.php, and im trying to get it to remove an image in: /images/products/example.jpg.

Would I be doing this correctly if I did this?

    unlink('../images/products/' . $filename);

or would this be incorrect? Any replies will be greatly appreciated.

È stato utile?

Soluzione

../images/products/' . $filename is correct (Note that its '..' not '.'). As long as you refer to the parent directory with '..' you can operate on anything in there.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top