ThinkPHP5.0多个文件上传后找不到临时文件的示例分析

这篇文章主要介绍ThinkPHP5.0多个文件上传后找不到临时文件的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

这是修改之前的代码

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第二个元素的时候出现了以下错误

ThinkPHP5.0多个文件上传后找不到临时文件的示例分析 

 这是改良之后的代码    

 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="";
        }
      }

以上是“ThinkPHP5.0多个文件上传后找不到临时文件的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!