Hi,

I want to upload several pictures, and i try to use the
Zend_Form_Element_File.
These are the error messages i get:

Notice: Undefined index: tmp_name in
/library/Zend/File/Transfer/Adapter/Abstract.php on line 577
Warning: Invalid argument supplied for foreach() in
/library/Zend/Validate/File/Count.php on line 217
Notice: Undefined index: tmp_name in
/library/Zend/File/Transfer/Adapter/Abstract.php on line 577
Warning: Invalid argument supplied for foreach() in
/library/Zend/Validate/File/FilesSize.php on line 94
Notice: Undefined index: tmp_name in
/library/Zend/File/Transfer/Adapter/Abstract.php on line 577
Notice: Undefined index: name in /library/Zend/Validate/File/Extension.php
on line 198

What am i doing wrong?

In my form i have:
        $file = new Zend_Form_Element_File('file');
        $file->setLabel('File')
                    ->setDestination('/tmp')
                    ->addFilter('Rename', '/tmp/')
                    ->setRequired(true)
                    ->addValidator('Count', false, 1) // ensure only 1 file
                    ->setMaxFileSize(10 * 1024 * 1024) // limit to 10M
                    ->addValidator('FilesSize', true, '10MB')
                    ->addValidator('Extension', true, 'png'); // PNG

in my controller i have:


        $this->view->title = "Zend_Form File Upload test";
        $this->view->baseUrl = $this->_request->getBaseUrl();
        
        $form = new UploadForm();
        
        if ($this->_request->isPost()) {
             $formData = $this->_request->getPost();
           
                // success - do something with the uploaded file
                $uploadedData = $this->_request->getPost('file');
                
       $adapter = $form->file->getTransferAdapter()
        try {           
                $adapter->receive();                                   
//<-- here it goes wrong...
        } catch (Zend_File_Transfer_Exception $e) {
                Utils::log($e->getMessage());
                $e->getMessage();
        }

the version i currently use is 1.6.2 but i also tried to use 1.6.1 and
1.7.0PR

I hope anybody can help me or can supply me with a working sample.

TIA

Marc Gobel







-- 
View this message in context: 
http://www.nabble.com/Not-able-to-get-file-upload-to-be-working-tp20536045p20536045.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to