I have followed tutorial: http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html
but I have problem handling situation when I upload file, but other field does not meet validation criteria and user is directed to fix form errors. Then when user fix problem and hit submit button, he no longer has valid image in form and missing file error is displayed.
I have prepared small example project to illustrate this behavior:
https://github.com/Jaslanin/sf_upload_form_error
Steps to reproduce this behavior:
- open web/ dir of project inside browser
- in name field put string "123"
- set image file for file field
- hit submit button
- change name field to "123456"
- hit submit button
- observe that form has missing file error
For now I handled this problem using steps within "How to Handle File Uploads with Doctrine" tutorial, but without using lifecyclecallbacks. I run ->upload manually and in case of error store file path inside session.
It works, but I am looking for cleaner solution for that problem.