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;
               
            }

 

posted @ 2015-08-25 17:14  笑笑别人  阅读(422)  评论(0编辑  收藏  举报