Question : store file into specific directory laravel using storage facade
Answered by : thoughtless-teira-sqmg9eba5d2d
php artisan storage:link
Source : https://stackoverflow.com/questions/45825889/how-to-create-laravel-storage-symbolic-link-for-production-or-sub-domain-system | Last Update : Fri, 20 Mar 20
Question : laravel storage save file folder on disk
Answered by : innocent-ibis-9on92639suvu
Storage::disk('public')->putFile('folder-destination', $request->file('file-to-save'));
Source : | Last Update : Sun, 26 Sep 21
Question : how to save file in storage folder in laravel
Answered by : muhammad-ishaq
//first run this command to generate symbolic link
php artisan storage:link
//then in controller function
$fileTemp = $request->file('file');
if($fileTemp->isValid()){ $fileExtension = $fileTemp->getClientOriginalExtension(); $fileName = Str::random(4). '.'. $fileExtension; $path = $fileTemp->storeAs( 'public/documents', $fileName );
}
//above code will save your file in 'storage/app/public/documents' location
//and using symbolic link we can access this file here 'public/storage/documents'
//Now Open or download file in blade template
<a href="{{url(Storage::url($document['file']))}}">Open/Download</a>
Source : https://laravel.com/docs/9.x/filesystem#file-uploads | Last Update : Tue, 27 Sep 22