标签:
<?php
namespace Home\Controller;
use Home\Controller\EmptyController;
class TestController extends EmptyController
{
public function test()
{
if(empty($_POST[‘submit‘]))
{
$this->display();
}
else
{
$upload = new \Think\Upload(); //实例化文件上传类 第一个斜杠不能少
$upload->maxSize = 3145728;
$upload->exts = array(‘jpg‘,‘jpeg‘,‘png‘);
$upload->savePath = ‘./‘;
$CuoWuXinXi = $upload->upload();
if(!$CuoWuXinXi)
{
$this->error($upload->getError());
}
else
{
$this->success(‘上传成功‘);
}
}
}
}
标签:
原文地址:http://www.cnblogs.com/lovling/p/5638275.html