Symfony2 & Twig - theming file upload widget
A better way to customize the file widget will be
{% block file_widget %} {% spaceless %} //Your custom content here {% endspaceless %}{% endblock file_widget %}
For example:
{% block file_widget %} {% spaceless %} <td>{% set type = type|default('file') %} <input type="{{ type }}" {{ block('widget_attributes') }} /> </td> {% endspaceless %}{% endblock file_widget %}
Remember that "{% spaceless %}" is very important
Just pointing to the new url of the solution in a more obvious way :
http://symfony.com/doc/current/cookbook/form/create_form_type_extension.html
So it looks I'm terrible at googling for Symfony stuff. I eventually found this part of the Symfony cookbook: http://symfony.com/doc/master/cookbook/form/form_customization.html
Symfony2 calls it a Form Type Extension and they actually use adding a image tag to the file widget as their example.