Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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
Source by www.itsolutionstuff.com #
 
PREVIOUS NEXT
Tagged: #store #Laravel
ADD COMMENT
Topic
Name
6+9 =