Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
in includes/file.inc, near line 744, the following is found:
if ($max_size < 0) {
$upload_max = _file_convert_to_mb(ini_get('upload_max_filesize'));
// sanity check- a single upload should not be more than 50% the size limit of the total post
$post_max = _file_convert_to_mb(ini_get('post_max_size')) / 2;
$max_size = ($upload_max < $post_max) ? $upload_max : $post_max;
}
This setting should be reflected somewhere in the Admin > upload settings.
In cases like the Project Module (especially with Project Release as Node), file attachment very often can be far larger than the short description associated with the release. For releases distributed in binary form, attachments can easily be 10s of megabytes, resulting in awkward post_max_size values.
Above code exposes PHP post_max_size must be DOUBLE upload_max_filesize or Admin > upload settings will be rejected.
Comments
Comment #1
jherteng CreditAttribution: jherteng commentedboth post_max_size and upload_max_filesize must be in accordance... not just one or the other.
Comment #2
pwolanin CreditAttribution: pwolanin commentedI wrote the validation code you're referring to. The factor of two was an arbitrary choice, but seemed reasonable since a single node can have multiple attachments. However, I'm not sure this choice is clearly documented - I'll add a note to http://drupal.org/handbook/modules/upload/ and I'll add a child page to http://drupal.org/node/363 covering this like changing memory site is covered.
If you think this should be in the help text for the upload module (/admin/help/upload), then we'll need a patch for 5.x and 4.7.x.
Comment #3
pwolanin CreditAttribution: pwolanin commentedchanging version to 5.x, since this is present there as well.
Note that the PHP default value for POST_MAX_SIZE is 8 MB, while for UPLOAD_MAX_FILESIZE the default value is 2 MB. So, any site running with default PHP settings will get a 2 MB limit.
Comment #4
pwolanin CreditAttribution: pwolanin commentedFor details on these PHP directives, see: http://us3.php.net/manual/en/ini.core.php
I spent a while trying to figure out an appropriate validation behavior. Note also that the memory_limit can also become a limitiation for upload size.
See also this new handbook page: http://drupal.org/node/97193
Comment #5
mlncn CreditAttribution: mlncn commentedThe need to double post_max_size is not reflected in the handbook page itself?
That page needs a version or rewrite for Drupal 7, and it looks like creating and linking off to a dedicated troubleshooting page would make sense.
Comment #6
jhodgdonMoving this to the Documentation issue queue, since it seems now to be related to on-line documentation.
Comment #7
jcisio CreditAttribution: jcisio commentedLook at the current code, there is no need to double post_max_size.