all(); if (!$uploadInfoSectorialRequest->hasFile('reportfile')) { return $this->errorResponse( false, '', 500); } $file = $uploadInfoSectorialRequest->file('reportfile'); $data['name'] = Str::of($file->getClientOriginalName())->explode('.')->offsetGet(0); $extension = $file->getClientOriginalExtension(); $data['reportfile'] = $file->storeAs('file', $data['name'].".{$extension}"); dd($data); } public function download() { $file = public_path("/file/Clockify_Time_Report_Detailed_01_05_2022-31_05_2022.pdf"); $path = storage_path("public/file/Clockify_Time_Report_Detailed_01_05_2022-31_05_2022.pdf"); $headers = ['Content-Type: application/pdf']; $newName = 'itsolutionstuff-pdf-file-'.time().'.pdf'; return response()->download($path, $newName, $headers); } }