May I know how to upload large file, more than 5Mb in Laravel 5? I am trying to upload around 10MB image file but it is not uploading, I searched a lot and updated following settings in php.ini
post_max_size = 500M;
memory_limit = 500M;
upload_max_filesize = 500M
I have restarted Apache server but still having issue. Is there any other setting in php.ini
or in Laravel to upload large files? Please help.
Edit
$image = $request->file('image');
if($image && $image != '') {
$extension = $image->getClientOriginalExtension();
$imageName = $this->getUniqueName($extension);
$image->move('gimages/profile_images/', $imageName);
$profile_image = $imageName;
$update_user_data['image'] = $profile_image;
}
Thanks much!
If you want to upload big files you should use streams. Here’s the code to do it:
PHP will only require a few MB of RAM even if you upload a file of several GB.
Source: https://murze.be/2015/07/upload-large-files-to-s3-using-laravel-5/
See Lrvl5 doc for usage and config of Storage : https://laravel.com/docs/5.0/filesystem
I might be late here.
But as i thought someone might need a way to specifically stream file to
local storage instead of s3.
Here is how to stream a file to local storage. As documentation says
so to stream to local instead of using s3 as @koalaok mentioned in the answer you could use local. so it will be something like
In Laravel new version (+5.3) There is a 'Automatic Streaming' ability. U can use like this:
For more information please follow this docs and search for 'Automatic Streaming': https://laravel.com/docs/5.6/filesystem