[DB_DataObject_FormBuilder & HTML_QuickForm] File upload handling

From: Date: Thu, 11 Oct 2007 04:47:23 +0000
Subject: [DB_DataObject_FormBuilder & HTML_QuickForm] File upload handling
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-28084@lists.php.net to get a copy of this message
Hello, I'm fairly familiar with PEAR packages however I'm a bit stuck when it comes to managing file uploads using DB_DataObject + DB_DataObject_FormBuilder + HTML_QuickForm. In my form when I submit a file (which is optional in the form) I can move the uploaded file no problems in DataObject::preProcessForm() with the following code // check for uploaded file if($fb->_do->fb_preDefElements['program_pdf']->isUploadedFile()) { if(!$fb->_do->fb_preDefElements['program_pdf']->moveUploadedFile($_SERVER['PROGRAM'])) { print 'Failed to upload file'; } } and processForm() does the rest automatically to insert the program_file filename into the DB. Now my problem is when I go back to the form to edit some fields without uploading a new file, the processForm() erases the file upload record because there is no $_REQUEST['program_pdf']. So I'm looking for tips on how to manage all this without having to write my custom processForm callback method. Cheers, Tom

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