diff --git src/wp-admin/includes/file.php src/wp-admin/includes/file.php
index 6bb61cf..a0ef92d 100644
|
|
|
function _wp_handle_upload( &$file, $overrides, $time, $action ) { |
| 312 | 312 | |
| 313 | 313 | // A correct form post will pass this test. |
| 314 | 314 | if ( $test_form && ( ! isset( $_POST['action'] ) || ( $_POST['action'] != $action ) ) ) { |
| 315 | | return call_user_func( $upload_error_handler, $file, __( 'Invalid form submission.' ) ); |
| | 315 | return call_user_func_array( $upload_error_handler, array( &$file, __( 'Invalid form submission.' ) ) ); |
| 316 | 316 | } |
| 317 | 317 | // A successful upload will pass this test. It makes no sense to override this one. |
| 318 | 318 | if ( isset( $file['error'] ) && $file['error'] > 0 ) { |
| 319 | | return call_user_func( $upload_error_handler, $file, $upload_error_strings[ $file['error'] ] ); |
| | 319 | return call_user_func_array( $upload_error_handler, array( &$file, $upload_error_strings[ $file['error'] ] ) ); |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | $test_file_size = 'wp_handle_upload' === $action ? $file['size'] : filesize( $file['tmp_name'] ); |
| … |
… |
function _wp_handle_upload( &$file, $overrides, $time, $action ) { |
| 327 | 327 | } else { |
| 328 | 328 | $error_msg = __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.' ); |
| 329 | 329 | } |
| 330 | | return call_user_func( $upload_error_handler, $file, $error_msg ); |
| | 330 | return call_user_func_array( $upload_error_handler, array( &$file, $error_msg ) ); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | // A properly uploaded file will pass this test. There should be no reason to override this one. |
| 334 | 334 | $test_uploaded_file = 'wp_handle_upload' === $action ? @ is_uploaded_file( $file['tmp_name'] ) : @ is_file( $file['tmp_name'] ); |
| 335 | 335 | if ( ! $test_uploaded_file ) { |
| 336 | | return call_user_func( $upload_error_handler, $file, __( 'Specified file failed upload test.' ) ); |
| | 336 | return call_user_func_array( $upload_error_handler, array( &$file, __( 'Specified file failed upload test.' ) ) ); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | // A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter. |
| … |
… |
function _wp_handle_upload( &$file, $overrides, $time, $action ) { |
| 348 | 348 | $file['name'] = $proper_filename; |
| 349 | 349 | } |
| 350 | 350 | if ( ( ! $type || !$ext ) && ! current_user_can( 'unfiltered_upload' ) ) { |
| 351 | | return call_user_func( $upload_error_handler, $file, __( 'Sorry, this file type is not permitted for security reasons.' ) ); |
| | 351 | return call_user_func_array( $upload_error_handler, array( &$file, __( 'Sorry, this file type is not permitted for security reasons.' ) ) ); |
| 352 | 352 | } |
| 353 | 353 | if ( ! $type ) { |
| 354 | 354 | $type = $file['type']; |
| … |
… |
function _wp_handle_upload( &$file, $overrides, $time, $action ) { |
| 362 | 362 | * overriding this one. |
| 363 | 363 | */ |
| 364 | 364 | if ( ! ( ( $uploads = wp_upload_dir( $time ) ) && false === $uploads['error'] ) ) { |
| 365 | | return call_user_func( $upload_error_handler, $file, $uploads['error'] ); |
| | 365 | return call_user_func_array( $upload_error_handler, array( &$file, $uploads['error'] ) ); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback ); |