Browse Source

fix: fixed getSize in multiple upload

pull/1/head
wahyun 8 months ago
parent
commit
ca2619ae08
  1. 10
      app/Http/Controllers/ImageController.php

10
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)) {

Loading…
Cancel
Save