File attachments utilities

This utility module provides administrator and user with some additional tools for working with file uploads.

Note: This module now has the Stylistics module as a dependency (http://drupal.org/project/stylistics) which is used to deal with the issue of Javascript and CSS not being reloaded after a form error.

Also the module now allows different numbers of files to be uploaded depending on content type, though this demonstration doesn't really show it because there's only one file type.

Delete and keep

The user interface for keeping or deleting file attachments has been a problem to users for a long time (http://drupal.org/node/239800) and it's unlikely to get solved until Drupal 8. The problem is that it is not intuitive.

The Attachments module modifies the interface, as seen by the user, to make the process clearer. It removes the checkbox and replaces it with a button which displays the current action (Keep/Remove), it does the same to the "List" checkbox which is also unclear and displays "Show/Hide" instead.

The changes are implemented through jQuery and do not change the underlying functionality.

This option can now be switched off independently and a new option has been included to configure the overall Upload text so that it conforms to the new wording of the attachments table.

Permitted file extensions

The display of which files extensions are accepted on the upload page can be replaced by a new, configurable, display list.

Rather than just providing a simple list, extensions can be grouped (such as by overall type: Image, Document, Spreadsheet and so on) and the extensions which belong to those groups can be set. So that when the attachment upload element is displayed a much clearer list of extensions is provided.

There is a default group for any extensions not covered in the groups.

File upload limit

The ability to limit the size of individual file uploads, and also to limit the total file size limit per user already exists in Drupal. However this Attachments module provides the ability to specify a (configurable) limit to the number of files that can be uploaded per node. (On the example site this is set to 2.) When the limit is reached the upload element is replaced by a warning.

From version 6.x-1.3 you can specify the limit on a per-content type basis.

File attachment display style

The final enhancement is to allow an alternate display style to the usual table format. You can select a list style for file attachments instead which displays the attachments as an unordered list. Currently the effect is global for all content types that have file attachments, but will be enhanced to be content-type specific.

As of version 6.x-1.4 other modules can add new ways of displaying file attachments, and the label "Attachments" can be configured (but not for the Drupal default style which remains "Attachments").

Work on this module was facilitated by the Workshop.