Upload file size are determined by your server’s PHP settings. The default values for PHP will restrict you to a maximum 2 MB upload file size.
Page for the upload module based on two PHP settings, ‘post_max_size’ and ‘upload_max_filesize’. Since ‘post_max_size’ is the limit for all the content of your post, potentially including multiple uploaded files, the upload module limits the size of a single attachment to be 50% of post_max_size, or 100% of upload_max_filesize, whichever is smaller. The default PHP values are 2 MB for upload_max_filesize, and 8 MB for post_max_size.
Depending on your host, changing these two PHP variables can be done in a number of places with the most likely being php.ini or .htaccess (depending on your hosting situation).
For example, to increase the limit on uploaded files to 10 MB:
Add the below to the relevant php.ini file (recommended, if you have access). Note that for some hosts this is a system-wide setting. However, for hosts running PHP as a CGI script with suexec (for example) you may be able to put these directives in a php.ini file in your root directory.
- upload_max_filesize = 10M;
- post_max_size = 20M;
Add the below to your .htaccess file in the you root directory.
- php_value upload_max_filesize 10M
- php_value post_max_size 20M
The PHP documentation states that the memory_limit setting also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. If this is an issue, add this:
- in php.ini, memory_limit = 18M;
- in .htaccess, php_value memory_limit 18M
upload_max_filesize is the the maximum size of an uploaded file.
post_max_size also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size. When an integer is used, the value is measured in bytes. Shorthand notation may also be used. If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty. This can be tracked in various ways, e.g. by passing the $_GET variable to the script processing the data, i.e. <form action="edit.php?processed=1">, and then checking if $_GET[‘processed’] is set.
memory_limit sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.
(PHP allows shortcuts for bit values, including K (kilo), M (mega) and G (giga). PHP will do the conversions automatically if you use any of these. Be careful not to exceed the 32 bit signed integer limit (if you’re using 32bit versions) as it will cause your script to fail.)