Improving the file attachments form in Drupal

As I already explained in a previous post, I am very fond of spending time improving things that don’t usually get a lot attention from Drupal developers and themers. Even if many of the interfaces shipped by default in Drupal provide a very systematic and procedural environment for administrating the content, you sometimes need to add a bit of gloss to make things prettier and easier to use for your clients. When I start a project, I invariably add a bunch of theme overrides, CSS files and small scripts that help me reach that goal. This time I am going to expose the technique I use to beautify the upload form for file attachments. Here is what it looks like when I am done:

My beautified File Attachments form

The problem(s)

File attachments form issues

In my (very) own opinion, the default file attachments form, even if very functional, suffers from a few main problems :

My solution

All this lead to users either totally unaware of this feature or struggling with basic operations. Here is what I usually do:

The result can be seen in the picture posted at the top of this post.

How to?

By hacking the core upload module of course! More seriously, this is mainly done by overriding theming functions (I am a big fan of overriding pretty much anything I can). Attached to that post, you will find the archive of a folder named “upload” that you can dump in you theme’s folder. This folder contains almost everything that you need: CSS and JS files, images… On top of that, you will need to do two things:

That’s quite a lot of code: you can find it in the template.php.txt file attached to this post.

Enjoy!