php - Symfony: display image in update view -


I have created a form that has an input type file field. I want to display the attached image in the update action. However, in insert mode I only want to display the input type file field.

These are the functions that make up my custom form:

  public function buildForm (FormBuilderInterface $ builder, array $ option) {$ creator - & gt; Add ('name', 'text', array ('atri' => array ('class' => form-control')) -> Add ('photo', 'file', array ('data_class' = & gt; null, 'required' = & gt; wrong, 'property_path' = & gt; getFoto ())) - & gt; SetMethod ("POST"); } Public Function Set Default Options (OptionsResolverInterface $ resolver) {$ resolver- & gt; Set defaults (array ('data_class' = & gt; 'myprocess \ mybandle' unit 'Premio')); }  

You can create a form type extension to extend the file type type .

You have an example on Symphony documentation, which answers what you are asking for.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -