Skip to content
Snippets Groups Projects
Commit f940e4a0 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

display uploadable file size in media manager FS#2425

parent 22ef1e32
No related branches found
No related tags found
No related merge requests found
......@@ -99,6 +99,7 @@ $lang['searchmedia_in'] = 'Search in %s';
$lang['txt_upload'] = 'Select file to upload';
$lang['txt_filename'] = 'Upload as (optional)';
$lang['txt_overwrt'] = 'Overwrite existing file';
$lang['maxuploadsize'] = 'Upload max. %s per file.';
$lang['lockedby'] = 'Currently locked by';
$lang['lockexpire'] = 'Lock expires at';
......
......@@ -1602,7 +1602,35 @@ function media_uploadform($ns, $auth, $fullscreen = false){
echo NL.'<div id="mediamanager__uploader">'.NL;
html_form('upload', $form);
echo '</div>'.NL;
echo '<p class="maxsize">';
printf($lang['maxuploadsize'],filesize_h(media_getuploadsize()));
echo '</p>'.NL;
}
/**
* Returns the size uploaded files may have
*
* This uses a conservative approach using the lowest number found
* in any of the limiting ini settings
*
* @returns int size in bytes
*/
function media_getuploadsize(){
$okay = 0;
$post = (int) php_to_byte(@ini_get('post_max_size'));
$suho = (int) php_to_byte(@ini_get('suhosin.post.max_value_length'));
$upld = (int) php_to_byte(@ini_get('upload_max_filesize'));
if($post && ($post < $okay || $okay == 0)) $okay = $post;
if($suho && ($suho < $okay || $okay == 0)) $okay = $suho;
if($upld && ($upld < $okay || $okay == 0)) $okay = $upld;
return $okay;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment