w00t!!! File uploads work!!

For the past few days I learned how to write a Drupal module so I can support file uploads & downloads at shareyourmusic.com. I finally figured out why it wasn’t working.

The _form hook changed at some point. According to the documentation, it should be

function my_form(&$node, &$help, &$error)

After looking through the source code, I determined that it was actually being invoked as:

my_form(&$node, &$error, &$param)

In order to support file uploads, I had to add an option to $param specifying enctype=multipart/form-data. Once I got that straightened out, my module was able to properly locate the uploaded file. This was the biggest hurdle that kept me from opening the site.

One response to “w00t!!! File uploads work!!

  1. that has tripped up a bunch of people. please contribute back a patch to the docs.