Symfony 5, EasyAdmin3 : Field ImageField, How not to delete?

Excuse me for my English.

In a form I use the ImageField (esasyadmin 3) like this :

$img = ImageField::new('img')
->setBasePath('images)
->setUploadDir('public/images)
->setUploadedFileNamePattern('[name].[extension]')
->setRequired(false)
;

The goal is to choose an image from the “public/images” folder.
However, if I decide to change this image, it removes the image I had previously selected from the folder.
I don’t want this behavior because my image can be used elsewhere.
How to prevent this deletion?
Have I chosen the right type of control?
Thank you

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *