Frage

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.

War es hilfreich?

Lösung

../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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top