非法字符串偏移'tmp_name'cakephp3

时间:2018-02-10 12:17:59

标签: php cakephp offset

我有一个大问题,我无法在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' 

我不明白为什么?

1 个答案:

答案 0 :(得分:0)

仅限使用

$temp_name = $this->request->data['Pictures']['tmp_name'];