Re: Quickform - File uploads

From: Date: Tue, 02 Sep 2003 04:14:57 +0000
Subject: Re: Quickform - File uploads
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7532@lists.php.net to get a copy of this message
Just so you know, here is my code so far: $form = new HTML_QuickForm('import_excel', 'post'); $form->addElement('file', 'xls_file', 'File:'); $form->addRule('xls_file', 'You must select a file', 'required'); $form->addElement('submit', 'btnUpload', 'Upload'); if ($form->validate()) { # If the form validates then freeze the data $form->freeze(); $form->process('process_data', false); } else { $form->display(); } function process_data($values) { global $form; if ($form->isUploadedFile('xls_file')) { $x = $form->moveUploadedFile('xls_file', 'E:/temp'); print $x; } else { print "No file uploaded"; } } Works ok, but it would be nice to fix up the validation. Cheers Leonie

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