file('file'); $ext = $request->file('file')->getClientOriginalExtension() ? '.'.$request->file('file')->getClientOriginalExtension() : null; $fileName = $request->fileName ? $request->fileName : Carbon::now()->timestamp. '_' . Str::random(10).$ext; $path = 'uploads/' .date('Ymd/').$fileName; Storage::put($path, file_get_contents($file->getRealPath())); return [ 'fileName' => $fileName, 'url' => $path, 'fullUrl' => Storage::url($path), 'ext' => $ext, ]; } public function download(DownloadRequest $request) { $url=$request->url; return Storage::download($url); } }