Search
 
SCRIPT & CODE EXAMPLE
 

PHP

store image in storage laravel

/*
|=================================================================
| How to store files in laravel -- (Public , Storage , S3)
|=================================================================
*/
 $request->validate([
   'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
 ]);

 $image = $request->image;              
 $imageName = time() . '.' . $image->extension(); 
        
 // 1) Store in Storage folder -- (Path => storage/app/images/file.png)
 $image->storeAs('images', $imageName);

 // 2) Store in Public Folder -- (Path => public/images/file.png)
 $image->move(public_path('images'), $imageName);

 // 3) Store in AMAZON S3 -- (Path => public/images/file.png)
 $image->storeAs('images', $imageName, 's3');
Comment

laravel image store

$fileName = $file->storePublicly('images/media', [
            'disk' => 's3'
        ]);
Comment

File/Image store in Laravel

   $request->validate([
            'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
        ]);
        
        
$imageName = time() . '.' . $request->image->extension(); 
        
Store in Storage folder
$request->image->storeAs('images', $imageName);
// storage/app/images/file.png



Store in Public Folder
$request->image->move(public_path('images'), $imageName);
// public/images/file.png


Store in S3
$request->image->storeAs('images', $imageName, 's3');


  

// public/images/file.png
Comment

Call storage images - laravel

<img src="{{ url('storage/yourforlder/yourimage.jpg') }}" alt="" title="" />
Comment

PREVIOUS NEXT
Code Example
Php :: php return json data to ajax 
Php :: order by in datatable laravel 
Php :: session cakephp 
Php :: valet switch php version 
Php :: laravel joins 
Php :: cambiar entre versiones de php linux 
Php :: laravel username validation 
Php :: wordpress loop over posts but exclude current post 
Php :: The `url` supplied for the path (./nova) repository does not exist 
Php :: php absolute value 
Php :: brew php version 
Php :: php must be an array or an object that implements Countable i 
Php :: php.ini location 
Php :: laravel curl package 
Php :: implode and explode in php 
Php :: laravel session add 
Php :: aapanel ubuntu 20.04 
Php :: Carbon Add Hours In Laravel 
Php :: laravel forcefill 
Php :: curl php 
Php :: remove item in an array php 
Php :: get post data in laravel 
Php :: php binary to base64 
Php :: laravel button redirect 
Php :: infinite cookie good php ? 
Php :: php unique id 
Php :: multiple logical condition in laravel query 
Php :: ternary operator for three conditions in php 
Php :: laravel tree 
Php :: get domain url with https in laravel 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =