show upload limit in media upload UI, see #12853

git-svn-id: http://svn.automattic.com/wordpress/trunk@14682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
wpmuguru 2010-05-15 23:57:32 +00:00
parent 3f6a32a5ce
commit be5268eefc
2 changed files with 17 additions and 2 deletions

View File

@ -1419,6 +1419,21 @@ jQuery(document).ready(function($){
<?php echo $errors['upload_error']->get_error_message(); ?>
<?php } ?>
</div>
<div id="media-upload-size">
<?php
$upload_size_unit = $max_upload_size = wp_max_upload_size();
$sizes = array( 'KB', 'MB', 'GB' );
for( $u = -1; $upload_size_unit > 1024 && $u < count( $sizes ) - 1; $u++ )
$upload_size_unit /= 1024;
if ( $u < 0 ) {
$upload_size_unit = 0;
$u = 0;
} else {
$upload_size_unit = (int) $upload_size_unit;
}
printf( __( 'Maximum upload file size: %d%s' ), $upload_size_unit, $sizes[$u] );
?>
</div>
<?php
// Check quota for this blog if multisite
@ -1453,7 +1468,7 @@ SWFUpload.onload = function() {
"tab" : "<?php echo $tab; ?>",
"short" : "1"
},
file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
file_size_limit : "<?php echo $max_upload_size; ?>b",
file_dialog_start_handler : fileDialogStart,
file_queued_handler : fileQueued,
upload_start_handler : uploadStart,

View File

@ -203,7 +203,7 @@ function wp_default_scripts( &$scripts ) {
// these error messages came from the sample swfupload js, they might need changing.
$scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
'file_exceeds_size_limit' => sprintf( __('This file is too big. The maximum upload size for your server is %s.'), $max_upload_size ),
'file_exceeds_size_limit' => __('This file exceeds the maximum upload size for this site.'),
'zero_byte_file' => __('This file is empty. Please try another.'),
'invalid_filetype' => __('This file type is not allowed. Please try another.'),
'default_error' => __('An error occurred in the upload. Please try again later.'),