Q:

symfony2 forms - check if user wants to change his uploaded file

in my form I got a file upload field, where the user can upload his avatar. So obviously he should be able to change it when he likes to.
But somehow, if I want to upload a different image, symfony2 does not recognize that.
I used LifecycleCallbacks for the Document Entity as described here: http://symfony.com/doc/current/cookbook/doctrine/file_uploads.html#using-lifecycle-callbacks
Has anybody done such a thing and can tell me how to check, if the user wants to upload a different file?

A:

You can compare the md5/sha hash of the newly uploaded image and current image in @PreUpdate callback.

