這是上傳函數和上傳路徑
class FileController extends Controller{
public function upload(){
$upload = new \Think\Upload();// 實例化上傳類
$upload->maxSize = 0 ;// 附件上傳大小
$upload->exts = array('jpg','gif','png','jpeg');// 附件上傳類型
$upload->rootPath = './ueditor/php/upload/image/'; // 附件上傳目錄
$upload->saveName = 'com_create_guid';// 采用GUID序列命名
$info=$upload->upload();
if(!$info){
$this->error($upload->getError());
}else{
foreach($info as $file){
$this->success($file['savepath'].$file['savename']."上傳成功!",'',3);
}
}
$model = M('File');
$data['savename'] = $info[0]['savename'];
$data['create_time'] = NOW_TIME;
$model->add($data);
}
這是download.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>下載</title>
<link href="__PUBLIC__/css/download.css" rel="stylesheet" type="text/css">
</head>
<body>
<form method="get">
<table>
<tr>
<td><a href="__APP__/Home/File/download/id/{$id}">下載</a></td>
</tr>
</table>
</form>
</body>
</html>
好吧無人問津的題目還是去TP官網問