Can't upload large images - php

I'm writing php based image gallery. For the project I'm using CodeIgniter framework.
The sers can upload up to 5 images.
When a small images (800px in width) are uploaded it works. The problem comes when user try to upload 5 images each of them about 2mb and > 3200px in width.
In this case the images are not uploaded and $_POST is empty.
Here is what I did so far but unfortunately didn't help
I changed the default values in php.ini with this
max_execution_time = 180
max_input_time = 160
emory_limit = 228M
What could be the problem?

Look at:
upload_max_filesize = 10M
post_max_size = 10M

You also permuted few letters in the name of variable:
emory_limit = 228M
It should be memory_limit.

After a quick google, which I'm sure you could have done, I found this website with all the details you need.
The main indication is to add:
php_value upload_max_filesize 10M - The maximum file size that can be uploaded.
php_value post_max_size 10M - The maximum amount of post data allowed by PHP.
php_value max_input_time 300 - The amount of time a script can run before being terminated.
php_value max_execution_time 300 - The amount of time before a timeout that the site should upload a file.

Related

Getting an error 413 Request Entity Too Large while using a plugin Croppic

I am using a jquery plugin CROPPIC to my web application to crop and compress the pictures before uploading them to database.
While I am using it I am able to crop and upload the picture size below 1MB but size above 1MB gives me an error in the console panel which is 413 Request Entity Too Large.
Form more information I am working in PHP language. When I searched about the issue I came across various solutions like put some of the codes to my php.ini file.
max_input_time = 24000
max_execution_time = 24000
upload_max_filesize = 12000M
post_max_size = 24000M
memory_limit = 120000M
client_max_body_size 24000M
max_file_uploads = 20
php_value
post_max_size 104857600
But all of these things are not working. If you like you can have a look to my project at http://www.bookiiee.com/ad_post.php and can ask more. Please help me out of this. I am working on the same issue for more than 2 days.
You need to increase the LimitRequestBody directive. Example:
LimitRequestBody 0

Increase max file upload size for SilverStripe site

I am working on increasing the max upload file size for a SilverStripe site as I want the new limit to be 20 MB instead of 2 MB. I have placed this line of code in the root .htaccess file for the project:
php_value upload_max_filesize 20M
This works to some extent. It has increased the upload size limit, but only to 8 MB. I removed this line of code and tried uploading a large file again and the "file size exceeds 2 MB" error returned. So, what I have in place does work but only increases the file size limit to 8 MB.
I have been reading that there can be a php.ini file included in the project to increase the file size limit as well, but I am wondering if there is a way to do it through just the .htaccess file?
The reason for this problem is because you've not set your post_max_size. The post_max_size defaults to 8mb. So you need to do the following:
php_value upload_max_filesize 20M
php_value post_max_size 50M
You can obviously edit the post_max_size to something more suitable to what you need.
This 100% work in v4
Your problem is indeed related to php.ini.
In php.ini there is a section related to file uploads that will have the following line in it;
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
Change the 2M to be something more in line with what you need, then restart apache and you should be good to go.
It is also possible (though i have not tried this yet) to put the following line in to the .htaccess.
php_value upload_max_filesize 20M
Hope that helps.

How to change max upload size for files in Wordpress 4.4 at xampp

I wanted to upload a template to wordpress 4.4 which is running on xampp but it says that I only can upload 2MB. I've googled the problem and found an information that i need to change the parameter upload_max_filesize=32M in the file php.ini. I doesn't found the file in the Wordpress folder but in the xampp folder I found a file called php.ini with the parameter in it and I changed the parameter but nothing happened.
What can I do to increase the max template upload space?
Have you tried this already? http://www.wpbeginner.com/wp-tutorials/how-to-increase-the-maximum-file-upload-size-in-wordpress/ It contains plenty of ways to increase the max upload size.
Make sure you increase post_max_size and upload_max_filesize, both limits.
So for example in PHP.ini:
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
Cause it may take longer to upload those files, you might want to increase max_execution_time as well.
post_max_size is the maximum size for all POST body data. upload_max_filesize is a maximum size only for files that are POSTed. Other types of POST body data are not subject to this limit. See Brad's answer over here: PHP post_max_size vs upload_max_filesize, what is the difference?

High resolution images do not resize properly when uploaded

When uploading high resolution images such as 3000x3000 or more, the image is uploaded but it bypasses the resizing process, both when using GitHub and PHPImageMagician.
Increasing the settings in php.ini did not fix the issue.
php.ini
memory_limit:32M
upload_max_filesize:20M (was 2M)
max_execution_time:60 (was 30)
max_input_time:60
May be this is problem of upload image timeout limit so I suggest you please update this value
Go to this Path
C:\wamp\bin\apache\apache2.2.8\bin\php.ini
Change to:
post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M
Restart WAMP to try again.

i have a image sharing script. the max allowed file upload is 5MB what should i set my max_input_time and my max_execution_time?

I ask because since max_input_time is the only that should be set accordingly to facilitate the upload process, how would you ever know what to set it to. Everyone's connection is different some may take longer to upload then others.
Also what are the risks of setting it too high? For example if i choose to allow users to upload bigger files then 5MB.
Please give me as much details as possible on the matter. Thanks.
Use this for big size file upload in .htaccess
php_value memory_limit 300M
php_value upload_max_filesize 200M
php_value post_max_size 200M
php_value max_execution_time 80000
php_value max_input_time 80000

Categories