unfiltered_upload fix from Nazgul. fixes #4136

git-svn-id: http://svn.automattic.com/wordpress/trunk@5353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-04-30 15:54:50 +00:00
parent 247d22682a
commit f47ebf8582
1 changed files with 5 additions and 2 deletions

View File

@ -1948,13 +1948,16 @@ function wp_handle_upload( &$file, $overrides = false ) {
return $upload_error_handler( $file, __( 'Specified file failed upload test.' ));
// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
if ( $test_type && !current_user_can( 'unfiltered_upload' ) ) {
if ( $test_type ) {
$wp_filetype = wp_check_filetype( $file['name'], $mimes );
extract( $wp_filetype );
if ( !$type || !$ext )
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
if ( !$ext )
$ext = strrchr($file['name'], '.');
}
// A writable uploads dir will pass this test. Again, there's no point overriding this one.