标签:color pat roo inf blog 实例 action and xhtml
控制器
function wenjian() { if(empty($_FILES)) { $this->display(); } else { $u = new \Think\Upload();// 实例化上传类 $u->maxSize=1024000 ;// 设置附件上传大小 $u->exts=array(‘jpg‘, ‘gif‘, ‘png‘, ‘jpeg‘);// 设置附件上传类型 $u->rootPath ="./Public/"; //根路径 $u->savePath="Uploads/"; // 设置附件上传目录 $u->saveName = ‘time‘; // 上传文件 $info = $u->upload(); var_dump($info); } }
显示
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<form action="__ACTION__" method="post" enctype="multipart/form-data">
<input type="file" name="file" />
<input type="submit" value="上传" />
</form>
</body>
</html>
标签:color pat roo inf blog 实例 action and xhtml
原文地址:http://www.cnblogs.com/bilibiliganbei/p/6232236.html