summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-08-01 01:33:42 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-08-01 01:33:42 +0000
commit69d069ce520ac696ee7bd1ec57d97dd1c4e3202f (patch)
treef8e4001eb537b46c3931d4a7bd65a13fb494db4f
parentc220873e15c384514eb08f2315490a9646eb07cf (diff)
downloadbrdo-69d069ce520ac696ee7bd1ec57d97dd1c4e3202f.tar.gz
brdo-69d069ce520ac696ee7bd1ec57d97dd1c4e3202f.tar.bz2
#619434 by jim0203, jablko: Fixed can't set 'default maximum file size per upload' when upload_max_filesize() is '0' (unlimited).
-rw-r--r--includes/file.inc10
1 files changed, 8 insertions, 2 deletions
diff --git a/includes/file.inc b/includes/file.inc
index 9fbecfed0..34cb472b2 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -1784,9 +1784,15 @@ function file_upload_max_size() {
static $max_size = -1;
if ($max_size < 0) {
+ // Start with post_max_size.
+ $max_size = parse_size(ini_get('post_max_size'));
+
+ // If upload_max_size is less, then reduce. Except if upload_max_size is
+ // zero, which indicates no limit.
$upload_max = parse_size(ini_get('upload_max_filesize'));
- $post_max = parse_size(ini_get('post_max_size'));
- $max_size = ($upload_max < $post_max) ? $upload_max : $post_max;
+ if ($upload_max > 0 && $upload_max < $max_size) {
+ $max_size = $upload_max;
+ }
}
return $max_size;
}