Don't over sanitize uploaded file titles. Props hakre. fixes #9081
git-svn-id: http://svn.automattic.com/wordpress/trunk@11198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cc3d87bf2b
commit
8d6ec42ce1
|
@ -189,15 +189,19 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
|
|||
$time = $post->post_date;
|
||||
}
|
||||
|
||||
$name = $_FILES[$file_id]['name'];
|
||||
$file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
|
||||
|
||||
if ( isset($file['error']) )
|
||||
return new WP_Error( 'upload_error', $file['error'] );
|
||||
|
||||
$name_parts = pathinfo($name);
|
||||
$name = trim( substr( $name, 0, -(1 + strlen($name_parts['extension'])) ) );
|
||||
|
||||
$url = $file['url'];
|
||||
$type = $file['type'];
|
||||
$file = $file['file'];
|
||||
$title = preg_replace('/\.[^.]+$/', '', basename($file));
|
||||
$title = $name;
|
||||
$content = '';
|
||||
|
||||
// use image exif/iptc data for title and caption defaults if possible
|
||||
|
|
Loading…
Reference in New Issue