Skip to content

How to Download File/Image from URL in Laravel, PHP

Last updated on November 17, 2022

Downloading images and files from the URL is simple and easy with Laravel’s Illuminate\Support\Facades\Storage; class.

We gonna use file_get_contents function to reads the entire file into a string, we have to give its output to Storage’s class put method.

Storage::disk('local')->put('arjunphp_laravel.png', file_get_contents('https://arjunphp.com/wp-content/uploads/2015/06/arjunphp_laravel.png'));

5 3 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments