It seems this has come up several times. People trying to use the 'file' type element in their forms have no reason to know they need to include...

$form['#attributes'] = array('enctype' => 'multipart/form-data');

...in their form array.

Could this be added to the 'file' element in the Usage Example or at least as a footnote. The FAPI Reference seems like the best place to put such a tip.

(One recent query... http://drupal.org/node/111764. I don't know if that handbook page was ever written, but the reference should mention this, too.)

Comments

add1sun’s picture

Status: Active » Fixed

Thanks. I've added a note to the file element in the form api reference along with a link to the new handbook page that was created from that thread - Handling File Uploads.

Anonymous’s picture

Status: Fixed » Closed (fixed)