You're correct - the example in the symfony docs violates the SR principle.
A cleaner way of handling uploads would be creating a doctrine listener/subscriber that is responsible for handling this process outside of your entity.
A very nice implementation is the VichUploaderBundle.
It can be configured using annotations or YAML ...
... provides (optional) integration with the filesystem abstraction library Gaufrette by KnpLabs ...
... and is pretty easy to set up.
I definitely recommend giving it a try or browse the source if you're looking for an implementation example.