S
S
Sergey Miller2021-02-03 13:23:53
MODX
Sergey Miller, 2021-02-03 13:23:53

Modx api how to delete a file from a directory?

Hello.

The modx api has the ability to delete a resource, an object. I'm making a "change profile pictures" page. I'm trying to do the following - when the user has uploaded new photos and clicked the save button, then it would be necessary to delete the old photos from the folder in the root public_html/user_upload . I get links to old photos. What command can be used to delete files?

I tried it like this, but it didn't work.

$modx->remove($photo1);

Or modx api can't do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2021-02-03
@blackseabreathe

MODX API does not know how, you need to use the standard PHP methods.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question