thinkphp 没有选择上传文件
<html>
<head><title>文件上传</title></head>
<body>
<form method="post" action="__URL__/upload" enctype="mulitypart-form/data">
选择上传文件:<input type="file" name="myfile"><br />
<input type="submit" name="sbumit" value="提交">
</form>
</body>
</html>
class UploadAction extends Action{
function index(){
$this->display();
}
public function upload(){
import('ORG.NET.UploadFile');
$upload = new UploadFile();
$upload->maxSize = 200000;
$upload->allowExts=array('jpg', 'gif', 'png', 'jpeg');
$upload->saveRule = uniqid;
$upload->savePath = './Public/Uploads/';
$upload->thumb = true;
$upload->thumbMaxWidth = 120 ;
$upload->thumbMaxHeight = 140;
$upload->thumbRemoveOrigin = false;
$upload->thumbPath ='./Public/Thumb/';
if($_FILES['myfile']['error'] > 0){
echo 'error';
}else{
echo "success";
}
if($upload->upload()){
$Info =$upload->getUploadFileInfo();
echo $Info;
}else{
echo $_FILES['myfile']['error'];
$this->Error($upload->getErrorMsg());
}
}
// 文件上传
}
总是显示没有选择上传文件,请问有知道是怎么回事的吗?
thinkphp 上传
[解决办法]
具体提示信息或者报错信息呢?
[解决办法]
你看看你的html代码写好没?你的phpini开启没有?
[解决办法]
mulitypart-form/data
应该是:multipart/form-data