summaryrefslogtreecommitdiff
path: root/includes/file.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/file.inc')
-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;
}