Non blank file input field in Symfony2 form

后端 未结 3 1717
灰色年华
灰色年华 2020-12-10 13:14

In my Doctrine entity, which is data_class for my form I have a file property defined like this:

/**
     * Image.
     *
     * @Assert\\NotBla         


        
3条回答
  •  温柔的废话
    2020-12-10 14:11

    I have was in similar situation. I try to edit existing record in database with path to the file. When i edit record i must upload new file, what is not comfortable for users. In my solution i use variable tmp file for file hash and variable file name. All needed operation i made in Action edit class.

    Full example action class in bellow link

    https://github.com/marekz/php_examples/wiki/Symfony-how-to-edit-attachment-form

提交回复
热议问题