From 2498bb6cae8dc571d74bf999668bfb7a7bb8c438 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 5 Nov 2009 14:24:20 +0000 Subject: [PATCH] Bring in wp_handle_upload_prefilter from MU git-svn-id: http://svn.automattic.com/wordpress/trunk@12142 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/file.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index 15f26d15a1..8742759b10 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -223,9 +223,15 @@ function wp_handle_upload( &$file, $overrides = false, $time = null ) { } } + $file = apply_filters( 'wp_handle_upload_prefilter', $file ); + // You may define your own function and pass the name in $overrides['upload_error_handler'] $upload_error_handler = 'wp_handle_upload_error'; + // You may have had one or more 'wp_handle_upload_prefilter' functions error out the file. Handle that gracefully. + if ( isset( $file['error'] ) && !ctype_digit( $file['error'] ) && $file['error'] ) + return $upload_error_handler( $file, $file['error'] ); + // You may define your own function and pass the name in $overrides['unique_filename_callback'] $unique_filename_callback = null;