Re: QuickForm 3.2 file upload bug?

From: Date: Mon, 08 Dec 2003 19:40:49 +0000
Subject: Re: QuickForm 3.2 file upload bug?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9382@lists.php.net to get a copy of this message
Hi! Tim Glen wrote:
I updated to QuickForm 3.2 a couple days ago and just noticed something strange on one of my pages. When I was uploading a file, QuickForm wasn't seeing it. It existed in the $_FILES array but it wasn't being set as the value for the file object. Testing for upload using $upload_file->isUploadedFile(); returned false.
I suspect this has nothing to do with upgrade to 3.2
After some testing and trying, I found that it made a difference how I created the element: // this doesn't work $upload_file = &HTML_QuickForm::createElement('file', 'the_file', 'upload file'); $form->addElement($upload_file); // this works $form->addElement('file', 'the_file', 'upload file'); $upload_file = $form->getElement('the_file'); When I create the field statically, the field gets created properly, but the _value isn't being set properly inside the file class. When I do it the second way, everything works fine.
http://pear.php.net/bugs/bug.php?id=80 In short, use: $upload_file =& $form->addElement('file', 'the_file', 'upload file');

« previous php.pear.general (#9382) next »