Skip to content Skip to navigation

Module for Uploading Documents


I spent a bit of time looking into ways to allow for the upload and display of documents in Drupal 6.x. I've written up a little summary of my experience below. This is not the only (or maybe even the best) way to achieve the intended results, but I thought it might prove helpful to someone faced with a similar issue down the road.

My goal was to identify a means to allow course assistants to upload the "slide deck" from a class session and have the document(s) available both on the node for that particular session, as well as aggregated on a single page for easy access.

After surveying the Drupal community on campus, I decided to implement the FileField module. I could have used "upload" as part of CCK, but felt FileField had the following benefits:

Why use FileField?

  1. Per-field upload control (file extensions, file size).
  2. Per-node upload size limits.
  3. Multiple fields per content type.
  4. Customizable paths for saving uploads (plus token support for dynamic paths).
  5. Icons for uploaded file types.

Based on suggestions on the Drupal site, I also installed the Transliteration module (which modifies the names of the uploaded documents to be web-friendly) and the filefield_paths module.
FileField, as the name implies, allows a user to create a new field (type:file) that I display to the user when editing a node type:session. In this fashion, users may upload a document, give it a title, and it will be associated with that particular node (which in this instance is related to a particular class session). There are a number of addition admin features to consider. In may case, I allowed an unlimited number of documents to be upload and restricted the file types to pdf, txt, ppt, doc. I also left in the option to "list" the document - a check box that will toggle on/off the display to a general user. I also leverage the upload features for other documents used on the site which are uploaded into a unique directory. It also allows me to *not* display these files on the aggregated class handout page because the files are not associated with the node type:session.

Once I had the documents being displayed on the particular session node, I needed to create a page which aggregated all the documents in a single page. To do this, I created a "view" with the following parameters:

Created new filter - file_field
Created new view - Node type Session, filter file_field
Display needed to be distinct so that if a Session had multiple files, the Session title is only displayed once.
I also added an html header to the page so that when no documents were available, the user was informed that they would be added as the sessions took place.

To see the final results, visit: - the class website. Note that you won't see any documents until the quarter gets underway.

I emphasize that there are many ways to achieve these results, but this was the recipe I came up with and it seems to be working well. The only other option I'm considering adding is a upload "progess bar" but that's icing and I need to consider whether I want to install another module for a non-essential feature. Let me know if you have any questions.