tags:

views:

264

answers:

5

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

A: 

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.

Unkwntech
+2  A: 

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.

Richard Turner
A: 

Make sure you changed upload_max_filesize AND post_max_size

Greg
+2  A: 

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");
ConroyP
+7  A: 

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
Mark Biek