QuickForm - display uploaded filename
| From: | Joerg Bruckmann | Date: | Mon, 10 Mar 2003 13:24:06 +0000 |
| Subject: | QuickForm - display uploaded filename | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-4128@lists.php.net to get a copy of this message | ||
Hi,
I would like to display the name of an uploaded file after the form
submission and I'm not sure if I missed a QuickForm feature doing this. Is
there any? That's how I do it (other fields and code skipped, QuickForm
2.10):
if ($form->validate()) {
// get name of uploaded file
$assetName = $form->_submitFiles['asset']['name'];
// add element for displaying the name of the uploaded file
$form->addElement('text', 'assetorigin', 'uploaded Asset:');
// set value of the new element to the name of the uploaded file
$defaultValues['assetorigin'] = $assetName;
// remove submit button
$form->removeElement('submit', true);
// remove file element since the value cannot be set
$form->removeElement('asset', true);
// freeze and display the form
$form->freeze();
$form->display();
}
Thanks for any tip. Great package btw!
Regards,
Joerg Bruckmann