Commit 584e18ac authored by drumm's avatar drumm

- Patch #199955 by saxofaan: file_upload_max_size() returns results in bytes, not in mega bytes.

parent f91615ab
......@@ -721,7 +721,7 @@ function file_directory_path() {
* Determine the maximum file upload size by querying the PHP settings.
*
* @return
* A file size limit in MB based on the PHP upload_max_filesize and post_max_size
* A file size limit in bytes based on the PHP upload_max_filesize and post_max_size
*/
function file_upload_max_size() {
static $max_size = -1;
......
......@@ -117,7 +117,7 @@ function upload_admin_settings_validate($form_id, $form_values) {
$default_uploadsize = $form_values['upload_uploadsize_default'];
$default_usersize = $form_values['upload_usersize_default'];
$exceed_max_msg = t('Your PHP settings limit the maximum file size per upload to %size MB.', array('%size' => file_upload_max_size())).'<br/>';
$exceed_max_msg = t('Your PHP settings limit the maximum file size per upload to %size.', array('%size' => format_size(file_upload_max_size()))).'<br/>';
$more_info = t("Depending on your sever environment, these settings may be changed in the system-wide php.ini file, a php.ini file in your Drupal root directory, in your Drupal site's settings.php file, or in the .htaccess file in your Drupal root directory.");
if (!is_numeric($default_uploadsize) || ($default_uploadsize <= 0)) {
......@@ -126,7 +126,7 @@ function upload_admin_settings_validate($form_id, $form_values) {
if (!is_numeric($default_usersize) || ($default_usersize <= 0)) {
form_set_error('upload_usersize_default', t('The %role file size limit must be a number and greater than zero.', array('%role' => t('default'))));
}
if ($default_uploadsize > file_upload_max_size()) {
if ($default_uploadsize * 1024 * 1024 > file_upload_max_size()) {
form_set_error('upload_uploadsize_default', $exceed_max_msg . $more_info);
$more_info = '';
}
......@@ -144,7 +144,7 @@ function upload_admin_settings_validate($form_id, $form_values) {
if (!is_numeric($usersize) || ($usersize <= 0)) {
form_set_error('upload_usersize_'. $rid, t('The %role file size limit must be a number and greater than zero.', array('%role' => $role)));
}
if ($uploadsize > file_upload_max_size()) {
if ($uploadsize * 1024 * 1024 > file_upload_max_size()) {
form_set_error('upload_uploadsize_'. $rid, $exceed_max_msg . $more_info);
$more_info = '';
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment