Don't let people upload files bigger than PHP will allow, and echo out the limit. This should be done for the inline uploader too (ping mdawaffe)

git-svn-id: https://develop.svn.wordpress.org/trunk@4388 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2006-10-13 07:44:35 +00:00
parent 97b1fde162
commit 63202c0f73
1 changed files with 11 additions and 1 deletions

View File

@ -1937,11 +1937,21 @@ function wp_import_cleanup($id) {
}
function wp_import_upload_form($action) {
$size = strtolower( ini_get('upload_max_filesize') );
$bytes = 0;
if ( strstr( $size, 'k' ) )
$bytes = $size * 1024;
if ( strstr( $size, 'm' ) )
$bytes = $size * 1024 * 1024;
if ( strstr( $size, 'g' ) )
$bytes = $size * 1024 * 1024 * 1024;
?>
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo $action ?>">
<p>
<label for="upload"><?php _e('Choose a file from your computer:'); ?></label> <input type="file" id="upload" name="import" size="25" />
<label for="upload"><?php _e('Choose a file from your computer:'); ?></label> (<?php printf( 'Maximum size: %s', $size ); ?>)
<input type="file" id="upload" name="import" size="25" />
<input type="hidden" name="action" value="save" />
<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
</p>
<p class="submit">
<input type="submit" value="<?php _e('Upload file and import'); ?> &raquo;" />