为什么我的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个回答
展开全部
mulitypart-form/data 写错啦
应该是:multipart/form-data
应该是:multipart/form-data
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
镭速传输
2024-10-28 广告
2024-10-28 广告
作为深圳市云语科技有限公司的一员,我们推出的FTP替代升级方案,旨在解决传统FTP在安全性、效率、稳定性及管理方面的不足。我们的产品通过采用自主研发的Raysync传输协议,实现高效、安全的文件传输,即使在恶劣网络环境下也能确保传输的稳定性...
点击进入详情页
本回答由镭速传输提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询