非法字符串偏移'tmp_name'cakephp3

问题描述 投票:-1回答:1

我有一个大问题,我无法上传cakephp中的文件,我有一个错误:

 if(!empty($this->request->data['Pictures']['name'])){
            $foto_name=$this->request->data['Pictures']['name'];

            $foto_tmp = $this->request->data['Pictures']['name']['tmp_name'];
            $path=WWW_ROOT.'img'.DS.'myimage'.$foto_name;
            move_uploaded_file($foto_tmp, $path);


        }

而错误是:

Warning (2): Illegal string offset 'tmp_name' 

我不明白为什么?

php cakephp offset
1个回答
0
投票

仅限使用

$temp_name = $this->request->data['Pictures']['tmp_name'];
© www.soinside.com 2019 - 2024. All rights reserved.