
August 28th, 2006, 04:22 AM
|
|
|
|
Join Date: Apr 2007
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
html_quickform uploadfile cleared on validation failure
windows xp, php5.2, pear 1.4.9, html_quickform 3.2.6
Hi Folks,
i have a form that has a file upload element and some other elements. i browse to a file and the filename is filled into to the left of the browse button. But when i submit the form that has other validation errors, the filename is not redisplayed when the form is redisplayed. This forces the user to have to re-browse each time they submit a form with another validation error (even if they had properly filled in the filename in the first place). What am i missing ? Has anyone seen and resolved this problem ? Thanks in advance!
ted
Here is a trimmed down script:
php Code:
Original
- php Code |
|
|
|
<?php define('UPLOAD_DIR', 'uploads'); // load the PEAR HTML_QuickForm package require_once 'HTML/QuickForm.php'; // create form $form = new HTML_QuickForm('upload_test','POST' ); // required text form $form->addElement('text','text1','Text: ' ); $form->addRule('text1','Enter some text.','required'); // upload file $args='size="40"'; $file = $form->addElement('file','upfile','Upload file: ', $args ); $form->addRule('upfile','Upload a file.','uploadedfile'); // submit button $form->addElement('submit','Submit','Submit'); // validate/process or (re)display if ( $form->validate() ) { $form->process( 'save_data' ); } else { $form->display(); }
|