Laravel-snappy: Easy way to save files directly to S3?

Created on 21 Apr 2017  路  2Comments  路  Source: barryvdh/laravel-snappy

Hi,

So I can generate pdf files on my server and save them locally or download to browser. However, instead of storing them on the web server, it would be ideal if the files could be pushed directly to S3.

Currently, I am saving them to local storage path, then uploading the pdf to S3 (using Storage::put to move to AWS S3) and deleting the local copy. Is there a way to save files directly to cloud?

Thanks!

Most helpful comment

Fixed! In case anyone else is wondering, just use $pdf->output() to stream the file:

$pdf = PDF::loadView('pdf.invoice', $data);
Storage::put($file, $pdf->output()); 

In my case, default storage has already been setup as "S3" in config

All 2 comments

Fixed! In case anyone else is wondering, just use $pdf->output() to stream the file:

$pdf = PDF::loadView('pdf.invoice', $data);
Storage::put($file, $pdf->output()); 

In my case, default storage has already been setup as "S3" in config

Thanks, this saved my life..phewww

Was this page helpful?
0 / 5 - 0 ratings

Related issues

medspec picture medspec  路  4Comments

oscarAG picture oscarAG  路  4Comments

leonardosapiras picture leonardosapiras  路  3Comments

hilmanfaiz picture hilmanfaiz  路  5Comments

vitorarjol picture vitorarjol  路  4Comments