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 :: showing php code in browser 
Php :: php abs() 
Php :: php top frameworks 
Php :: calculate sum (total) of column in php 
Php :: how to add property to an exsisting object in php 
Php :: how to get a particular column in laravel 8 
Php :: php convert to lowercase 
Php :: php syntax <<< 
Php :: php array json encode key and value 
Php :: how to backup laravel project 
Php :: laravel validation required_if one parameter exist 
Php :: php get url 
Php :: insall laravel 
Php :: laravel model casts 
Php :: laravel clear page cache 
Php :: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known 
Php :: find the highest number from array in php 
Php :: php declare strict_types 
Php :: E: Unable to locate package php8.0 
Php :: php const 
Php :: password_hash 
Php :: php check if any of multiple values in array 
Php :: how to add an custom error to validater error in laravel 
Php :: laravel translate 
Php :: html_entity_decode (PHP 4 = 4.3.0, PHP 5, PHP 7, PHP 8) html_entity_decode — Convert HTML entities to their corresponding characters 
Php :: substract 2 dates php 
Php :: cake php 2.x joins 
Php :: laravel collection transform 
Php :: break and continue in laravel 
Php :: show data from a table in laravel 8 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =