0

我使用 000webhost 作为托管我的网站组合的一种方式。但是,我收到了这个错误,但在本地主机上并没有发生在我身上。

 Notice (8): Undefined index:  Upload [APP/Controller/UploadsController.php, line 32]

这似乎是它所指的代码,

 public function add() {
            $this->render();


        if($this->request->is('post')){

            $file = $this->request->data['Upload']['file'];
                    if($this->Upload->save($this->data) && move_uploaded_file($file['tmp_name'],APP.'webroot/files/uploads'.DS.$this->Upload->id.'.mp4')) 
                        {
                                $this->Session->setFlash('<p class="uploadflash">The upload has been saved</p>', true);

                                $this->redirect(array('controller'=>'Uploads', 'action' => 'watch', $this->Upload->id));
                            }   else {
                        $this->Session->setFlash('<p class="loginerror">The upload could not be saved, mp4 files can be saved only.</p>', true);    

                                }

                                }
                    }

关于为什么会发生这种情况的任何想法?此外,我的 Elements 也没有出现在这个在线主机上?我在页面上抛出了这个错误

      Element Not Found: Elements/uploads/recentuploads.ctp 

其他人好像有这个问题??

4

1 回答 1

0

经过进一步检查,我发现服务器不允许文件上传大小超过 2mb,在这种情况下 PHP 会抛出上述错误。

于 2012-06-30T15:57:20.113 回答