WordPress.org

Make WordPress Core

Changeset 4388


Ignore:
Timestamp:
10/13/2006 07:44:35 AM (12 years ago)
Author:
matt
Message:

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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r4383 r4388  
    19381938
    19391939function wp_import_upload_form($action) {
     1940    $size = strtolower( ini_get('upload_max_filesize') );
     1941    $bytes = 0;
     1942    if ( strstr( $size, 'k' ) )
     1943        $bytes = $size * 1024;
     1944    if ( strstr( $size, 'm' ) )
     1945        $bytes = $size * 1024 * 1024;
     1946    if ( strstr( $size, 'g' ) )
     1947        $bytes = $size * 1024 * 1024 * 1024;
    19401948?>
    19411949<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo $action ?>">
    19421950<p>
    1943 <label for="upload"><?php _e('Choose a file from your computer:'); ?></label> <input type="file" id="upload" name="import" size="25" />
     1951<label for="upload"><?php _e('Choose a file from your computer:'); ?></label> (<?php printf( 'Maximum size: %s', $size ); ?>)
     1952<input type="file" id="upload" name="import" size="25" />
    19441953<input type="hidden" name="action" value="save" />
     1954<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
    19451955</p>
    19461956<p class="submit">
Note: See TracChangeset for help on using the changeset viewer.