Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

add configureFileUploadColumn

posted by mungiu 8 years ago

i want to add dinamically configureFileUploadColumn like this, where and how must to call that method.


                    fORM::defineActiveRecordClass($options[0] . "_media");
                    fORM::mapClassToTable($options[0] . "_media", $options[0] . "_media");
                    $class = $options[0] . "_media";
                    $media = new $class;
                    for ($index = 1; $index <= $value["max_length"]; $index++) {
                        //$file = $_FILES[$key . '_' . $index];

                        $this->addElement(new Zend_Form_Element_File($key . '_' . $index, array(
                                    "label" => fGrammar::humanize($key . $index)
                                )));

//if($file['size'] > 0) {
//$media->{"setPdf".$index}(1);

                        fORMFile::configureFileUploadColumn($options[0] . "_media", 'pdf_' . $index, $_SERVER['DOCUMENT_ROOT'] . '/PhpProject1/public/uploads/');

fORMFile::configureFileUploadColumn() requires a $class_name, $column_name and $filesystem_path to store the files in. Generally I recommend adding this method call to the ->configure() method in your fActiveRecord class.

class Media extends fActiveRecord
{
    protected function configure()
    {
        fORMFile::configureFileUploadColumn($this, 'column_name', $_SERVER['DOCUMENT_ROOT'] . '/uploads/');
    }
}
posted by wbond 8 years ago