diff --git a/app/Http/Controllers/Finance/DailyWorkLogController.php b/app/Http/Controllers/Finance/DailyWorkLogController.php index ab51da84..3da3e13e 100644 --- a/app/Http/Controllers/Finance/DailyWorkLogController.php +++ b/app/Http/Controllers/Finance/DailyWorkLogController.php @@ -9,7 +9,6 @@ use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; -use Illuminate\Support\Str; class DailyWorkLogController extends Controller { @@ -201,7 +200,7 @@ public function uploadFile(Request $request): JsonResponse $request->validate([ 'log_date' => 'required|date', 'field_key' => 'required|in:memo,reflection', - 'file' => 'required|file|max:10240', + 'file' => 'required|file|max:20480', ]); $tenantId = session('selected_tenant_id', 1); @@ -212,9 +211,10 @@ public function uploadFile(Request $request): JsonResponse ); $file = $request->file('file'); - $storedName = Str::uuid().'.'.$file->getClientOriginalExtension(); - $basePath = "daily-work-log/{$tenantId}/{$log->id}"; - $filePath = "{$basePath}/{$storedName}"; + $storedName = bin2hex(random_bytes(8)).'.'.$file->getClientOriginalExtension(); + $year = date('Y'); + $month = date('m'); + $filePath = "{$tenantId}/daily-work-log/{$year}/{$month}/{$storedName}"; Storage::disk('tenant')->put($filePath, file_get_contents($file));