Laravel upload Large images - php

I am trying to upload large images to server (binary file upload) via postman, it works fine for files sized 2 MB and below, however for files > 2 MB the upload fails
I set php.ini
upload_max_filesize = 100M
post_max_size = 100M
and
nginx /etc/nginx/nginx.conf
client_body_buffer_size 100M;
client_max_body_size 100M;
but it doesn't work
I tried plupload package for chunk upload but it also doesn't work for files > 2 MB
Any ideas how to upload large images in laravel ?

It's doen't work because you set the wrong php.ini file
do this on laravel dd(phpinfo()) and look the right php.ini use by laravel in the value
Loaded Configuration File

may be I am a bit late for you , but for sake of everyone else , you may consider using this package
Resumablejs
it split file into chunks and upload each one, and if one failed , it will retry until all parts is completely uploaded.

Related

File not upload

I am uploading a file In Laravel. If I upload a file of 2 MB then it is working, but If I upload a file of 10 MB it is not working. If I check php.ini it shows max_post_size 1024 MB and max_file_upload 1024 MB.
It is working fine on local. I am using centos and nginx server.
Probably you should change your php configuration file to allow receipt of bigger files. See the accepted answer to the question "Change the maximum upload file size"
Update: "By default, Nginx has a limit of 1MB on file uploads. To set file upload size, you can use the client_max_body_size directive, which is part of Nginx’s ngx_http_core_module module. This directive can be set in the http, server or location context."
For details see https://www.tecmint.com/limit-file-upload-size-in-nginx/
Do you after changing max_post_size and max_file_upload restart nginx service?
Maybe in error log you saw the answer:
/var/log/nginx/nginx_error.log

Upload large files on google cloud buckets

I'm trying to upload files to my bucket using this: https://cloud.google.com/appengine/docs/php/googlestorage/user_upload. I got it working but i can't upload files that are larger than 100 MB. The documentation says you can upload files up to 100 TB.
When I try to upload files larger than 100MB i get a request entity too large error.
Solved it. I had these 2 lines in my php.ini
upload_max_filesize = 100M
post_max_filesize = 100M
Changed it to
upload_max_filesize = 100G
post_max_filesize = 100G
and it worked.
When uploading larger files, you can consider the file to be chunked into small sets of requests that Google App Engine supports.
This package could help - https://github.com/pionl/laravel-chunk-upload

Cakephp file upload issue for number of files

upload plugin works excellent for me, but when I have multiple file upload-> select 30 images (approx 15 MB) -> Upload only 18-20 images. May be issued with a number of files. post_max_size I have updated from 8M to 20M in php.ini . I have solved the same by using dropzone.js instead of simple file upload.It has no issue upload 100 files at a time. Still want to know why simple file upload is not working?

PHP - Upload file reset

I'm facing an upload issue using PHP.
I upload the file using a form and the input type file provided from HTML, and I have to upload large files (max size 500MB).
I have edited my php.ini file in this way:
max_execution_time = 7200;
max_input_time = 7200;
memory_limit = 500M;
post_max_size = 500M;
upload_max_filesize = 500M.
I made many tests during the last weeks using small files (20 MB) and the upload was working fine.
Now I want to simulate the worst situation, when the user have to upload large files. I noticed that when the user tries to upload files larger than 100MB the upload "resets".
The page receives 2048000 bytes, then it restart from 0 and again, it resets when it reach 2048000 bytes. This happens for a couple of times then the upload stops.
I tried also to edit my httpd.conf adding the line:
LimitRequestBody 524288000
The problem is still present. How can I solve this?
I found what the problem was.
I never checked the nginx.conf file.
There is the an option called client_max_body_size that has to be edited.
In my case it was set to 100m (100MB), I changed it to 500m and I solved the problem.

Issue uploading Images into WordPress

When trying to upload images into WordPress, I keep getting this error:
413 Request Entity Too Large
nginx
I checked PHP.ini file to make sure I have the proper upload-able amount and I have 32mb
I have a dedicated server with Media Temple and have never had this issue before. Hope someone could shed some light?
The file sizes I am uploading are about 1 - 3 mb. Anything less than 1mb seems to go through.
This is not a php.ini issue. The error is coming from the web server nginx.
Add this line somewhere in your nginx server block (change 5M to whatever you need):
client_max_body_size 5M;
Try the following in your php.ini file and then restart the server. Restarting the server is key.
memory_limit 20MB
post_max_size 20MB
upload_max_filesize 20MB
max_execution_time 600

Categories