wzq 5 år sedan
förälder
incheckning
3abd4e83ae
1 ändrade filer med 4 tillägg och 2 borttagningar
  1. 4 2
      app/Http/Controllers/UploadController.php

+ 4 - 2
app/Http/Controllers/UploadController.php

@@ -20,7 +20,8 @@ class UploadController extends Controller
 //            $type=$request->file('image')->getClientMimeType();
 //            //获取文件的绝对路径,但是获取到的在本地不能打开
             $filePath = $request->file('image')->getRealPath();
-            if (in_array($kuoname, ['jpg', 'gif', 'png'])) {
+            Log::debug('文件类型'.$kuoname);
+            if (in_array($kuoname, ['jpg', 'jpeg', 'gif', 'png'])) {
                 $width = Image::make($filePath)->width();
                 $height = Image::make($filePath)->height();
                 //要保存的文件名 时间+扩展名
@@ -49,8 +50,9 @@ class UploadController extends Controller
         for ($i = 0; $i < $fileCount; $i++) {
             $kuoname = $files[$i]->getClientOriginalExtension();
             $filePath = $files[$i]->getRealPath();
+            Log::debug('文件类型'.$kuoname);
             //要保存的文件名 时间+扩展名
-            if (in_array($kuoname, ['jpg', 'gif', 'png'])) {
+            if (in_array($kuoname, ['jpg', 'jpeg', 'gif', 'png'])) {
                 $width = Image::make($filePath)->width();
                 $height = Image::make($filePath)->height();
                 //要保存的文件名 时间+扩展名