Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel storage save file folder on disk

Storage::disk('public')->putFile('folder-destination', $request->file('file-to-save'));
Comment

how to save file in storage folder in laravel

//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>
Comment

PREVIOUS NEXT
Code Example
Php :: storage link laravel 
Php :: php remove extension from url 
Php :: How to check even or odd number in php 
Php :: how to find php.ini 
Php :: redirect http to https htaccess 
Php :: laravel list all routes 
Php :: laravel random query 
Php :: check if string is number or not php 
Php :: Delete Query with Where Condition in Codeigniter 
Php :: your requirements could not be resolved to an installable set of packages. composer 
Php :: macos install php 7.4 
Php :: php routing htaccess 
Php :: wordpress print all categories 
Php :: php header pdf open in browser 
Php :: php get elapsed time 
Php :: php ucfirst all words 
Php :: php memory_limit unlimited 
Php :: composer update without dependencies 
Php :: check the php version in ubuntu 
Php :: php 3 months ago 
Php :: check image is available on server php 
Php :: laravel format number blade 
Php :: create and download text file in php 
Php :: Add 2 days to the current date in PHP 
Php :: how to set timezone for iran in laravel 
Php :: remove last letter php 
Php :: get current date laravel 
Php :: php mysql date format 
Php :: wordpress get username 
Php :: php change sting to caps 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =