unlink files

So i have a Multi Module Apllication , and i want to delete a file , currently i have the following :

unlink("{$_SERVER['DOCUMENT_ROOT']}/public/assets/frontend/images/agendas/{$agenda->image}")

Is there a more affective way ?



84.5k

what do you mean by affective?

what do you mean by affective?

Like not using $_SERVER , i want somthing like : /assets/frontend/images/

Hello,

I'm using :

unlink("img/" . $image->filename);

That works fine.

The current folder is 'public' (where is located the index.php).

So for you it's could be

unlink("assets/frontend/images/agendas/{$agenda->image}");

Hello. What about using: APP_PATH

unlink(APP_PATH."/public/assets/frontend/images/agendas/{$agenda->image}")