Full Stack LAMP - MEAN Developer, Python developer. Certified Azure Developer. Freelance programmer/consultant/trainer.

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

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'));

Leave a Reply