DOFormBuilder :: ImageUpload

From: Date: Fri, 05 Nov 2004 14:58:02 +0000
Subject: DOFormBuilder :: ImageUpload
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15352@lists.php.net to get a copy of this message
I wanted to include a virtual imageupload Field in my DataObject so i defined: class do_news extends DB_DataObject { .... ###END_AUTOCODE function insert($do = false){ require_once 'DB/DataObject/Cast.php'; $this->news_added = DB_DataObject_Cast::sql('NOW()'); $this->news_updated = DB_DataObject_Cast::sql('NOW()'); // parent::insert(); if (is_uploaded_file($_FILES['Image_Path']["tmp_name"])) { $this->Image_Path = $_FILES['Image_Path']["name"]; if (move_uploaded_file($_FILES['Image_Path']["tmp_name"], $this->id.".jpg") && chmod($this->id.".jpg", 0644)) { // echo "ok"; } } function preGenerateForm(&$fb) { $this->fb_preDefElements['news_text'] = HTML_QuickForm::createElement('textarea', 'news_text','Newstext',array("cols"=>"35","rows"=>"6")); $nr[0]="Normaler Bereich"; $nr[1]="Privater Bereich"; $this->fb_preDefElements['news_status'] = HTML_QuickForm::createElement('select', 'news_status','News Kategorie',$nr); // File Upload $this->fieldLabels = array ('Image_Path' => 'Choose image to upload'); $this->preDefElements['Image_Path'] = HTML_QuickForm::createElement('file', 'Image_Path', 'File to upload', 'maxfilesize=5000000'); } // Virtuelle Felder !!! function table() { return array_merge(parent::table(), array( 'Image_Path' => DB_DATAOBJECT_STR)); } var $fb_fieldsToRender=array('id','news_status','news_headline','news_subheadlin e','news_text','Image_Path'); } but in my form the field appears as a normal text field i guess the error is in the table() function thanks for help

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