store image in storage laravel

51

   $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
$fileName = $file->storePublicly('images/media', [
            'disk' => 's3'
        ]);

Comments

Submit
0 Comments