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: http://svn.automattic.com/wordpress/trunk@4388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e18222df3d
commit
94fc4bdc61
|
@ -1937,11 +1937,21 @@ function wp_import_cleanup($id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function wp_import_upload_form($action) {
|
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 ?>">
|
<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo $action ?>">
|
||||||
<p>
|
<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="action" value="save" />
|
||||||
|
<input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
|
||||||
</p>
|
</p>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
<input type="submit" value="<?php _e('Upload file and import'); ?> »" />
|
<input type="submit" value="<?php _e('Upload file and import'); ?> »" />
|
||||||
|
|
Loading…
Reference in New Issue