Home > Backend Development > PHP Tutorial > thinkphp 没有选择上传文件解决方案

thinkphp 没有选择上传文件解决方案

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:47:36
Original
1304 people have browsed it

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());
}
}

    // 文件上传



}
总是显示没有选择上传文件,请问有知道是怎么回事的吗?

------解决方案--------------------
具体提示信息或者报错信息呢?
------解决方案--------------------
你看看你的html代码写好没?你的phpini开启没有?
------解决方案--------------------
mulitypart-form/data 
应该是:multipart/form-data
Related labels:
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template