| Thomas Murphy 2007-10-11, 4:08 am |
| 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
|