diff --git a/app/Http/Controllers/ImageController.php b/app/Http/Controllers/ImageController.php index af18b45..1e3c194 100644 --- a/app/Http/Controllers/ImageController.php +++ b/app/Http/Controllers/ImageController.php @@ -75,12 +75,12 @@ class ImageController extends Controller } else { DB::rollBack(); unlink($destinationPath['pathImage'].$name); - return response()->json(['status' => 'failed','message' => 'image upload is failed! pertama' ,'code' => 400], 400); + return response()->json(['status' => 'failed','message' => 'image upload is failed!' ,'code' => 400], 400); } } else { DB::rollBack(); - return response()->json(['status'=>'failed','message'=>'image upload is failed! kedua','code'=>400], 400); + return response()->json(['status'=>'failed','message'=>'image upload is failed!','code'=>400], 400); } } else { DB::rollBack(); @@ -105,7 +105,10 @@ class ImageController extends Controller $company = Company::where('company_name', $request->company_name)->first(); if($company) { $totalSize = 0; - $sizeFile = $dokumen->getSize(); + $sizeFile = 0; + foreach ($dokumen as $file) { + $sizeFile += $file->getSize(); + } $destinationPath = $this->setCustomeDirectoryUpload($company['company_name']); $folderPath = $destinationPath['pathImage']; @@ -114,7 +117,6 @@ class ImageController extends Controller } $files = scandir($folderPath); - $totalSize = 0; foreach ($files as $file) { if (is_file($folderPath . '/' . $file)) {