/dev/random

Reality has a liberal bias

/dev/random random header image

w00t!!! File uploads work!!

January 21st, 2004 · 1 Comment · Drupal, Programming

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.

Tags:

1 response so far ↓

  • 1 moshe // Jan 22, 2004 at 1:25 pm

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