Home >Backend Development >PHP Tutorial > thinkphp 没选择上传文件

thinkphp 没选择上传文件

WBOY
WBOYOriginal
2016-06-13 12:42:41756browse

thinkphp 没有选择上传文件

文件上传



选择上传文件:







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 上传
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn