1

I am developing a CMS where the clients will need to upload files larger than 2mb - up to 10mb at least. I have changed the details in the php.ini file and I cannot see anywhere else that the problem might be. Any help?

Cheers

5 Answers 5

8

Here's what I recommend changing (assuming Apache & PHP):

I've found this works well for up to about 30mb attachments

PHP Settings

  • max_execution_time = 120
  • max_input_time = 120
  • memory_limit = 30M
  • post_max_size = 30M
  • upload_max_filesize 30M
  • file_uploads = On (although it sounds like you already have this turned)

Apache Settings

  • LimitRequestBody 31457280
Sign up to request clarification or add additional context in comments.

Comments

2

You need to set upload_max_filesize, post_max_size and memory_limit appropriately. post_max_size must be larger than upload_max_filesize, because there needs to be memory allocated for the request headers as well as the file payload.

Comments

2

In your php.ini:

; Maximum allowed size for uploaded files.
upload_max_filesize = 50M

; Maximum size of POST data that PHP will accept.
post_max_size = 50M

What errors are you getting in your error log once these have been done? Is it possible that your uploaded file is running foul of the memory limit on the script?

You can set the memory limit higher for this particular script by including the following line in your script:

ini_set("memory_limit","75M");

Comments

0

Make sure you changed upload_max_filesize AND post_max_size

Comments

-1

As long as you have restarted your web service (ie apache) then the changes should take effect, however if you are developing for anyone other then yourself then instead of changing the php.ini I would add this to the upload script:

ini_set('upload_max_filesize', '10M');

as some people may not be able to modify php.ini this will change it just for the page it is on.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.