Sachin Singh Sachin Singh - 1 year ago 64
PHP Question

Upload file from url to AWS in laravel

I know how to upload file from local storage to aws using laravel. But I want to upload file directly from external url to aws without downloading.

Any suggestion, how can I achieve this.

Answer Source

I finally solved this using Intervention Image Library.

use Image;
use Storage;


$image = Image::make('url');
$image->encode('jpg');
$s3 = Storage::disk('s3');
$filePath = '/profilePhotos/'.$time();
$s3->put($filePath, $image->__toString(), 'public');

Installation instructions for Image library can be found here in the "Integration in Laravel" section.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download