FileType multiple for collection field

I am trying to create a Symfony form for creating and editing an entity called ‘Movie’, that is uploading an image files path to the database and the files to the server folder. I want the uploading of these files to be multiple and able for drag and drop with preview of the image and the possibility for deleting a single image before submitting the form. This entity is having a collection field named ‘images'(entity ‘Image’ with relation – One movie Many images).

I could do the creating of this entity with FileType::class that is multiple(with the preview, drag, drop), but the problem comes when I will want to edit this ‘movie’, I don’t see how I will be able to edit the entity with the same functionality when the field is collection and I am using FileType::class.
My question is am I in the right way doing this, or there is some better option, if yes if I could use some help will be awesome.

This is my design at the moment:
File Input Div

enter image description here

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 *