Symfony2动态上传目录

I have followed the cookbook for file uploads (using the id as filename) and it works very good. I want to use this entity on my whole website. For example, admins can upload images for blog posts, users can upload certain file types in the comments etc.. Currently, all the files are saved in web/uploads/documents. But I want to save files in folders based on which form they are uploaded in. For example, images for blog posts are stored in web/uploads/blog/, user files are stored in web/uploads/MIMETYPE/ etc.. In the entity, the path is set in the getUploadDir function:

public function getUploadDir()
{
    return 'uploads/documents';
}

I thought of using form events, but I have no idea how to do that properly.

So, how can I achieve that if it is even possible without using different entities?