nao-pon / flysystem-google-drive

Flysystem adapter for Google Drive
MIT License
352 stars 128 forks source link

Error in uploading large file #21

Closed Arman8852 closed 7 years ago

Arman8852 commented 7 years ago

I am currently developing a Laravel 5.4 app running on PHP 7.I am trying to upload large file,size of 200-300 mb or small file of 10-12 kb to my google drive storage. I have changed my php.ini like this:

post_max_size = 800M

upload_max_filesize = 700M

I can upload small file.The problem occurred when I am trying to upload large file,size of 200-250 mb,the alotted php memory_limit surpasses and I get error.

I have used this controller method:

$files = $request->file('files');
if($request->hasFile('files')){

foreach ($files as $file) {

$name = $file->getClientOriginalName();
$disk = Storage::disk('google'); 
$disk->put($name, File::get($file));

     }
      }

So,I have searched google, how can I upload large file without surpassing the memory_limit

and I get this for Amazon S3 and I modified it for Google drive:

$disk = Storage::disk('google');
$disk->put($name, fopen($file, 'r+'));

But,now I am getting another error trying to upload any size of file (10kb-300mb):

(1/1) ErrorException
A non well formed numeric value encountered

in GoogleDriveAdapter.php (line 1143)
at HandleExceptions->handleError(8, 'A non well formed numeric value encountered', '/app/vendor/nao-pon/flysystem-google-drive/src/GoogleDriveAdapter.php', 1143, array('iniName' => 'memory_limit', 'val' => '128M', 'last' => 'm'))in GoogleDriveAdapter.php (line 1143)

How can I upload any size of file in Google drive without surpassing memory_limit ?

ivanvermeyen commented 7 years ago

It seems the issue has already been fixed in this commit: nao-pon/flysystem-google-drive@c276de4 But it is not yet tagged in a release.

nao-pon commented 7 years ago

@Arman8852 , @ivanvermeyen I tagged "1.1.6". Thanks!