最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
ThinkPHP5.0多个文件上传后找不到临时文件的修改方法
时间:2022-06-24 15:40:27 编辑:袖梨 来源:一聚教程网
这是修改之前的代码
if(!empty($_FILES)){
if(!empty($_FILES['org_positive'])){
$org_positive = request()->file('org_positive');
if($org_positive){
$info = $org_positive->move(ROOT_PATH . 'uploads');
$positive_path="/uploads/".$info->getSaveName();
}else{
$positive_path="";
}
}
if(!empty($_FILES['org_reverse'])){
$org_reverse = request()->file('org_reverse');
if($org_reverse){
$info1=$org_reverse->move(ROOT_PATH . 'uploads');
$reverse_path="/uploads/".$info1->getSaveName();
}else{
$reverse_path="";
}
}
if(!empty($_FILES['org_license'])){
$org_license = request()->file('org_license');
if($org_license){
$info2=$org_license->move(ROOT_PATH . 'uploads');
$license_path="/uploads/".$info2->getSaveName();
}else{
$license_path="";
}
}
}
在处理$_FILES第二个元素的时候出现了以下错误
这是改良之后的代码
if(!empty($_FILES)){
if(!empty($_FILES['org_positive'])){
$org_positive = request()->file('org_positive');
}
if(!empty($_FILES['org_reverse'])){
$org_reverse = request()->file('org_reverse');
}
if(!empty($_FILES['org_license'])){
$org_license = request()->file('org_license');
}
if($org_positive){
$info = $org_positive->move(ROOT_PATH . 'uploads');
$positive_path="/uploads/".$info->getSaveName();
}else{
$positive_path="";
}
if($org_reverse){
$info1=$org_reverse->move(ROOT_PATH . 'uploads');
$reverse_path="/uploads/".$info1->getSaveName();
}else{
$reverse_path="";
}
if($org_license){
$info2=$org_license->move(ROOT_PATH . 'uploads');
$license_path="/uploads/".$info2->getSaveName();
}else{
$license_path="";
}
}
本人是小白,在网上查找到资料说php上传文件后较短时间会删除临时文件,也就是$_FILES[‘file'][‘tmp_name']这个值,修改代码之后没有报错了,成功将临时文件转移了出来
相关文章
- 女神漫画-漫画阅读入口丨女神漫画官网首页入口 12-20
- 快手网页版登录入口-快手网页版一键直达地址大全 12-20
- 免费看韩漫在线阅读入口-韩漫在线观看完整版漫画 12-20
- 学信网四六级成绩查询入口_四六级成绩如何查询 12-20
- 植物大战僵尸在线中文版畅玩入口-植物大战僵尸中文官网一键开玩 12-20
- 豆包AI免费在线使用-豆包AI官网网页版直达入口 12-20
