? sites/default/settings.php ? sites/default/files/.htaccess ? sites/default/files/simpletest Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.304 diff -u -p -r1.304 form.inc --- includes/form.inc 15 Nov 2008 15:32:36 -0000 1.304 +++ includes/form.inc 16 Nov 2008 00:44:21 -0000 @@ -852,7 +852,7 @@ function form_error(&$element, $message * $_POST data. */ function form_builder($form_id, $form, &$form_state) { - static $complete_form, $cache, $file; + static $complete_form, $cache, $enctype, $file; // Initialize as unprocessed. $form['#processed'] = FALSE; @@ -865,6 +865,7 @@ function form_builder($form_id, $form, & if (isset($form['#type']) && $form['#type'] == 'form') { $cache = NULL; + $enctype = NULL; $complete_form = $form; if (!empty($form['#programmed'])) { $form_state['submitted'] = TRUE; @@ -948,14 +949,22 @@ function form_builder($form_id, $form, & if (isset($form['#type']) && $form['#type'] == 'file') { $file = TRUE; } + + // If an element requires to set the forms content type enctype attribute, we + // need to store this info in a static $enctype flag to update the parent form + // element. E.g. For files, non-ASCII data, and binary data. + if (isset($form['#enctype'])) { + $enctype = $form['#enctype']; + } + // We are on the top form, we can copy back #cache if it's set, and set the + // required enctype as required. if (isset($form['#type']) && $form['#type'] == 'form') { - // We are on the top form, we can copy back #cache if it's set. if (isset($cache)) { $form['#cache'] = TRUE; } // If there is a file element, we set the form encoding. - if (isset($file)) { - $form['#attributes']['enctype'] = 'multipart/form-data'; + if (isset($enctype)) { + $form['#attributes']['enctype'] = $enctype; } } return $form; Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.638 diff -u -p -r1.638 system.module --- modules/system/system.module 15 Nov 2008 08:23:07 -0000 1.638 +++ modules/system/system.module 16 Nov 2008 00:35:30 -0000 @@ -308,6 +308,7 @@ function system_elements() { $type['file'] = array( '#input' => TRUE, '#size' => 60, + '#enctype' => 'multipart/form-data', );