Download & Extend

Form enctype attribute is set incorrectly

Project:FileField
Version:6.x-3.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

The filefield_widget function sets the form encoding type incorrectly, erasing any other attributes that may exist on the form. It currently does $form['#attributes'] = array('enctype' => 'multipart/form-data');. What it should do is $form['#attributes']['enctype'] = 'multipart/form-data';, possibly checking first to make sure that the #attributes element exists and is an array.

In particular, the current mechanism will erase any custom classes that may have been added to the form previously.

Comments

#1

Version:6.x-3.0» 6.x-3.1
Status:active» fixed

Oddly we were doing it correctly in 2 places but not in the third. This patch corrects the problem and has been applied to CVS. It will be in the 3.2 version.

AttachmentSize
filefield_enctype_set.patch 809 bytes

#2

Title:Form attributes are set incorrectly» Form enctype attribute is set incorrectly

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.