Zend framework dosya yükleme yasadışı yüklendi

0 Cevap php

Ben diğer metin alanları ile normal bir form içinde dosya yüklemek için çalışıyorum.

Şimdiye kadar, dosya geçici bir klasöre yükledi alır ama benim destinationfolder için, ben her zaman bu hata "Dosya 'upload' yasadışı Bu olası bir saldırı olabilir. Yüklendiği" alamadım.

Ben TempFile dosya adını kontrol ettik ve doğru klasöre doğru url sahiptir.

Ben burada ne eksik.

        $form = new Zend_Form();
        $form->setAttrib('enctype', 'multipart/form-data');
        $form->setMethod('post')

             ->addElement('file', 'pdf', array(
                                            'size' => '40',
                                            'label' => 'Select File',
                                            'required' => true,
                                            'validators' => array(
                                                            'Size' => array('min' => 20, 'max' => 1000000)
                                                            )
                                            )
                        )

            ->addElement('submit', 'Save')
        ;

        if ( $this->getRequest()->isPost() ) {
            if ( $form->isValid($this->getRequest()->getParams()) ) {
                $id = $form->getValue('name');

                $upload = new Zend_File_Transfer_Adapter_Http();
                $uploadDestination = APPLICATION_PATH . '/../public/uploads/'.$id;

                if(!is_dir($uploadDestination)){
                    mkdir($uploadDestination, 0777, true);
                }

                $upload->setDestination($uploadDestination);
                echo $upload->getFileName();

                if($upload->receive('pdf'))
                {
                    echo '<pre>';
                    print_r($form->getValues());
                    die();
                }
                else
                {
                    $messages = $upload->getMessages();
                    echo implode("\n", $messages);
                    die();
                }

$ Yükleme-> ('pdf') alır; düzgün çalışmıyor ne olduğunu.

0 Cevap