How to keep the image in the input when you edit the Entity

284 views Asked by At

I'm sure that there is something about this "problem" somewhere but I didn't found it... I'm using Vich_Uploader bundle in my Symfony2 project. One entity has 1 reference image and a OneToMany secondary images. For the création, I've nearly no problem ( without the fact that my secondary images aren't linked to my Entity but that's not the point ) but during edit, there is nothing in the "Reference image" input and if I submit, I recieve the error : this input is required...

Someone got a tip to give the imageFile to the input?

Thanks & Regards,

Thomas

1

There are 1 answers

2
K-Phoen On

You can't automatically fill an upload field as it would induce great security issues. The solution to your problem would be to define your image fields as not required if there already are images (ie: the object is not new).