YII 1.0 上传文件

$upload = CUploadedFile::getInstance($articleModel,'thumb');
            if($upload){
                $name = date("Ymd"). time() . mt_rand(0,999);
                $img = $name . '.' . $upload->extensionName;
                if(!file_exists($this->upload_url)){
                    dir_create($this->upload_url);
                }
                $upload->saveAs($this->upload_url . $img);
                $data['thumb'] = $this->upload_url . $img;
               
            }
原文地址:https://www.cnblogs.com/mr-amazing/p/4758042.html