Article
Posted on 21st January 2009
Takes about 2 mins to read

So you've got a nice new version of Drupal 6 and you're building a form, but you want to allow users to upload a file. Of course this is easy with Drupal, and we covered how to do just that, but for Drupal 5, in our previous article: Example code to build an upload form in Drupal. Here we show how file uploads are done in Drupal 6. Honestly, not much has changed, here's the...

Published in: #Drupal Planet #upload #upload form
Article
Posted on 27th March 2007
Takes about 1 min to read

Putting together an upload form in Drupal 5 is easier than you think - there are just a couple of things you need to remember ... The form is built like this: function build_upload_form(){ $form['#attributes'] = array('enctype' => "multipart/form-data"); $form['file_upload']=array('#type'=>'file','#title'=>'Filename'); $form['submit']=array('#type'=>'submit','#value'=>'Upload file'); return $form; } And the submit is handled like so, note - the value passed into file_check_upload is the name (terminal array key) of the form element defined in your form building function...