#619434 by jim0203, jablko: Fixed can't set 'default maximum file size per upload' when upload_max_filesize() is '0' (unlimited).

merge-requests/26/head
Angie Byron 2010-08-01 01:33:42 +00:00
parent c220873e15
commit 69d069ce52
1 changed files with 8 additions and 2 deletions

View File

@ -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;
}