为什么我的thinkphp 没有选择上传文件?
<html><head><title>文件上传</title></head><body><formmethod="post"action="__URL__/upload"...
<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());
}
}
// 文件上传
}
总是显示没有选择上传文件,请问有知道是怎么回事的吗? 展开
<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());
}
}
// 文件上传
}
总是显示没有选择上传文件,请问有知道是怎么回事的吗? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询