QF - file upload and group

From: Date: Wed, 15 Nov 2006 10:05:55 +0000
Subject: QF - file upload and group
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-25834@lists.php.net to get a copy of this message
Hi, I'd like to upload some files. Here's my code: for ($a = 1; $a <= $_SESSION['site_shop_attachnum']; $a++) {
    ${'doc'.$a} =& HTML_QuickForm::createElement('text', 'attname'.$a, null);
    ${'att'.$a} =& HTML_QuickForm::createElement('file', 'attfile'.$a, null);
    $form->addGroup(array(${'doc'.$a}, ${'att'.$a}), 'attach'.$a, $strAdminShopProdAttach, '&nbsp;');
} for ($a = 1; $a <= $_SESSION['site_shop_attachnum']; $a++) {
    if (${'attach'.$a}['attfile'.$a]->isUploadedFile()) {
        $filevalues          = ${'attach'.$a}['attfile'.$a]->getValue();
        $sdir                = preg_replace('|/$|','', $_SESSION['site_shop_attachdir']).'/';
        ${'docname'.$a}      = time().preg_replace('|[^\d\w_\.]|', '_', change_char($filevalues['name']));
        ${'docname_real'.$a} = ${'attach'.$a}['attname'.$a];
        ${'attach'.$a}['attfile'.$a]->moveUploadedFile($sdir, ${'docname'.$a});
        @chmod($sdir.${'docname'.$a}, 0664);
    }
} But I always got an error, here -> if (${'attach'.$a}['attfile'.$a]->isUploadedFile()) Fatal error: Call to a member function on a non-object in /usr/home/web/devel/admin/shop_products.php on line 423 What's the problem with this? Thanks ZoTyA

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