无法上传文件:Laravel 中缺少临时目录

File could not be uploaded: missing temporary directory in Laravel

糟糕,好像出了点问题。 (1/1) 文件异常 无法上传文件:缺少临时目录。

在 UploadedFile.php 中(第 235 行) 在 UploadedFile->move('public/images/products/', 'products_8885101619419081.png') 在 ProductCtrl.php(第 54 行)

我的密码是:

      if($_FILES['attachFile']['name'] != NULL){
          $file = $request->file('attachFile');
          $photo ="products_".rand(1111,999999).strtotime('now').".".$file->getClientOriginalExtension();
          $des = "public/images/products/";
          $file->move($des,$photo);

          $mediaData['path'] = $photo;
       }

试试这个:

  if($_FILES['attachFile']['name'] != NULL){
      $file = $request->file('attachFile');
      $photo = "products_".rand(1111,999999).strtotime('now').".".$file->getClientOriginalExtension();
      $des = "public/images/products/" . $photo;
      $file->move($des,$file);

      $mediaData['path'] = $photo;
   }