Unlink temporary file if sideload fails. see #7220

git-svn-id: https://develop.svn.wordpress.org/trunk@8241 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-07-02 22:56:57 +00:00
parent 713216192b
commit 410403c076
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;
}
}