jeudi 27 août 2015

How to manage big files upload in L5 calss Storage using Flysystem package?

In my Laravel 5 set up, I included the Flysystem package, configured a disk in config/filesystems.php (ftp)

'ftp' => [
        'driver' => 'ftp',
        'host'      => env('FTP_HOST'),
                    'username'  => env('FTP_USER'),
                    'password'  => env('FTP_PASS'),
                    'passive' => TRUE,
    ],

Then I'm able to peform ftp upload and download with the following instructions:

Storage::disk('ftp')->put($filePath, $contents);
Storage::disk('ftp')->get($filePath);

Until here everything is fine. Problems start when I'm uploading big files. Above 200MB. PHP memory limit is reached and execution stops with fatal error. In fact when Storage->put is called my PC memory increases dramatically.

I've read somewhere that a solution might be to use Streams to perform read write from my "virtual" disk.

Actually I'm still missing how to implement it in order to optimize memory usage during these operations.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1NCw0Vp
via IFTTT

Aucun commentaire:

Enregistrer un commentaire