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

file storage laravel

// First Method
use IlluminateSupportFacadesStorage;
 
Storage::disk('local')->put('example.txt', 'Contents');

// Second Method

$request->file('image')->storePublicly('images/media', ['disk' => 'public']); 
Comment

PREVIOUS NEXT
Code Example
Php :: get random data laravel 
Php :: mt_rand 
Php :: curl exec not working php 
Php :: ci db query error 
Php :: send email php smtp hostinger 
Php :: sortbydesc on a collection laravel 
Php :: laravel blade skip entry 
Php :: how to run php file in xampp 
Php :: sanitize user input php 
Php :: publish config laravel 
Php :: wp get acf category in post 
Php :: php find text in variable 
Php :: error repoerting in php 
Php :: Add Product Short Description To Product Category In WooCommerce 
Php :: get table name from model laravel 
Php :: phpmailer send attachment 
Php :: disable cors policy symfony 
Php :: php to call javascript function 
Php :: php echo an array to console 
Php :: fetch row in php 
Php :: add user meta 
Php :: random integer php 
Php :: laravel remove duplicates from array 
Php :: osx php 
Php :: br php 
Php :: how to get only decimal value in php 
Php :: php curl example 
Php :: php days remaining 
Php :: get url with php 
Php :: compile custom/plain css with mix in laravel 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =