Wednesday, February 11, 2015

File upload failure to cakephp


Hi Grourp,

I m newbie to the CakePHP, trying to upload xlsx file to CakePHP

Below is my view code

            <?php
            echo $this->Form->create('Program', array('action' => 'importexcel', 'type' => 'file'));
            echo $this->Form->file('Document');
            echo $this->Form->submit(__('Upload', true));
            ?>

And below is my Controller code to print array for to check. Later i would like to use the output of the array to perform upload using PHPExcel.

    public function importexcel()
        {

                if (isset($this->data)) {
                echo 'DATA:';
                var_dump($this->data);
                echo 'FILES:';
                var_dump($_FILES);
                }
       }

Output of the controller is as below

DATA:
array    'Program' =>       array        'Document' => string 'import.xlsx' (length=11)

 
FILES:
array    empty  

I need to get the properties, data of the $this->data in the controller so that i can use them in IOFactory of PHPExcel for uploading.

Can someone please help me correct my view/controller code.

Thank you very much.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: