代码是
$upload = new \Think\Upload();// 实例化上传类
$upload->maxSize = C('mi_maxSize'); ;// 设置附件上传大小
$upload->exts = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
$upload->savePath = './Uploads/thumbnail/';
$upload->autoSub = true;
$upload->subName = array('date','Ymd');
$info = $upload->upload();
if(!$info) {
$this->error($upload->getError()); }
else{
$this->success('上传成功!');
}模版是 <form role="form" method="post" action="{:U('addcontent')}" enctype="multipart/form-data">
<input class="miniinput9" name="img" id="img" type="file">
<button type="submit" >发布</button>
</form > 最佳答案