Unlink temporary file if sideload fails. see #7220

git-svn-id: http://svn.automattic.com/wordpress/trunk@8241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-07-02 22:56:57 +00:00
parent eb1f9d0b39
commit 3497e63495
1 changed files with 1 additions and 3 deletions

View File

@ -340,10 +340,8 @@ function media_sideload_image($file, $post_id, $desc = null) {
$id = media_handle_sideload($file_array, $post_id, $desc);
$src = $id;
unset($file_array);
if ( is_wp_error($id) ) {
$errors['upload_error'] = $id;
@unlink($file_array['tmp_name']);
return $id;
}
}