diff --git src/wp-admin/includes/file.php src/wp-admin/includes/file.php
index 98e0f4962c..4889b527d6 100644
--- src/wp-admin/includes/file.php
+++ src/wp-admin/includes/file.php
@@ -1141,6 +1141,20 @@ function download_url( $url, $timeout = 300, $signature_verification = false ) {
 		return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ), $data );
 	}
 
+	$content_disposition = wp_remote_retrieve_header( $response, 'Content-Disposition' );
+
+	if ( preg_match( '/filename=("?)([^ ]+)\1/', $content_disposition, $matches ) ) {
+		$tmpfname_disposition = wp_tempnam( $matches[2] );
+
+		if ( $tmpfname_disposition && rename( $tmpfname, $tmpfname_disposition ) ) {
+			$tmpfname = $tmpfname_disposition;
+		}
+
+		if ( $tmpfname !== $tmpfname_disposition && file_exists( $tmpfname_disposition ) ) {
+			unlink( $tmpfname_disposition );
+		}
+	}
+
 	$content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
 
 	if ( $content_md5 ) {
