diff --git src/wp-admin/includes/deprecated.php src/wp-admin/includes/deprecated.php
index f6fa0a2..bca1b3b 100644
--- src/wp-admin/includes/deprecated.php
+++ src/wp-admin/includes/deprecated.php
@@ -1188,3 +1188,24 @@ function wp_dashboard_secondary_control() {}
 function _relocate_children( $old_ID, $new_ID ) {
 	_deprecated_function( __FUNCTION__, '3.9' );
 }
+
+
+/**
+ * Download an image from the specified URL and attach it to a post.
+ * This was once used by Press This
+ *
+ * @since 2.6.0
+ * @todo  add deprecated as of version
+ *
+ * @param string $file The URL of the image to download
+ * @param int $post_id The post ID the media is to be associated with
+ * @param string $desc Optional. Description of the image
+ * @return string|WP_Error Populated HTML img tag on success
+ */
+function media_sideload_image($file, $post_id, $desc = null) {
+	_deprecated_function( __FUNCTION__, '4.0' );
+	$attachment_id = media_handle_sideload( $file, $post_id, $desc );
+	if ( ! is_wp_error( $attachment_id ) ) {
+		return wp_get_attachment_image( $at, 'full' );
+	}
+}
\ No newline at end of file
diff --git src/wp-admin/includes/media.php src/wp-admin/includes/media.php
index d2cfb5c..d4923fd 100644
--- src/wp-admin/includes/media.php
+++ src/wp-admin/includes/media.php
@@ -353,14 +353,31 @@ function media_handle_upload($file_id, $post_id, $post_data = array(), $override
  *
  * @since 2.6.0
  *
- * @param array $file_array Array similar to a {@link $_FILES} upload array
+ * @param string|array $file A URL as a string, or an array similar to a {@link $_FILES} upload array
  * @param int $post_id The post ID the media is associated with
  * @param string $desc Description of the sideloaded file
  * @param array $post_data allows you to overwrite some of the attachment
  * @return int|object The ID of the attachment or a WP_Error on failure
  */
-function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
-	$overrides = array('test_form'=>false);
+function media_handle_sideload( $file, $post_id, $desc = null, $post_data = array() ) {
+
+	$downloading_url = is_string( $file );
+
+	if ( $downloading_url ) {
+
+		$file = array(
+			'name'     => basename( preg_replace( '/\?.*/', '', $file ) ), // fix file filename for query strings
+			'tmp_name' => download_url( $file ),
+		);
+
+		// If error storing temporarily, return the error.
+		if ( is_wp_error( $file['tmp_name'] ) ) {
+			return $file['tmp_name'];
+		}
+
+	}
+
+	$overrides = array( 'test_form' => false );
 
 	$time = current_time( 'mysql' );
 	if ( $post = get_post( $post_id ) ) {
@@ -368,9 +385,16 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
 			$time = $post->post_date;
 	}
 
-	$file = wp_handle_sideload( $file_array, $overrides, $time );
-	if ( isset($file['error']) )
+	$file = wp_handle_sideload( $file, $overrides, $time );
+
+	if ( isset( $file['error'] ) ) {
+
+		if ( $downloading_url ) {
+			@unlink( $file['tmp_name'] );
+		}
+
 		return new WP_Error( 'upload_error', $file['error'] );
+	}
 
 	$url = $file['url'];
 	$type = $file['type'];
@@ -404,8 +428,10 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
 
 	// Save the attachment metadata
 	$id = wp_insert_attachment($attachment, $file, $post_id);
-	if ( !is_wp_error($id) )
+
+	if ( ! is_wp_error( $id ) ) {
 		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
+	}
 
 	return $id;
 }
@@ -796,49 +822,6 @@ function wp_media_upload_handler() {
 }
 
 /**
- * Download an image from the specified URL and attach it to a post.
- *
- * @since 2.6.0
- *
- * @param string $file The URL of the image to download
- * @param int $post_id The post ID the media is to be associated with
- * @param string $desc Optional. Description of the image
- * @return string|WP_Error Populated HTML img tag on success
- */
-function media_sideload_image( $file, $post_id, $desc = null ) {
-	if ( ! empty( $file ) ) {
-		// Set variables for storage
-		// fix file filename for query strings
-		preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
-		$file_array['name'] = basename( $matches[0] );
-		// Download file to temp location
-		$file_array['tmp_name'] = download_url( $file );
-
-		// If error storing temporarily, return the error.
-		if ( is_wp_error( $file_array['tmp_name'] ) ) {
-			return $file_array['tmp_name'];
-		}
-
-		// do the validation and storage stuff
-		$id = media_handle_sideload( $file_array, $post_id, $desc );
-		// If error storing permanently, unlink
-		if ( is_wp_error( $id ) ) {
-			@unlink( $file_array['tmp_name'] );
-			return $id;
-		}
-
-		$src = wp_get_attachment_url( $id );
-	}
-
-	// Finally check to make sure the file has been saved, then return the html
-	if ( ! empty( $src ) ) {
-		$alt = isset( $desc ) ? esc_attr( $desc ) : '';
-		$html = "<img src='$src' alt='$alt' />";
-		return $html;
-	}
-}
-
-/**
  * {@internal Missing Short Description}}
  *
  * @since 2.5.0
@@ -2970,4 +2953,4 @@ function wp_read_audio_metadata( $file ) {
 	wp_add_id3_tag_data( $metadata, $data );
 
 	return $metadata;
-}
+}
\ No newline at end of file
diff --git src/wp-admin/press-this.php src/wp-admin/press-this.php
index 1becc48..5dd30b4 100644
--- src/wp-admin/press-this.php
+++ src/wp-admin/press-this.php
@@ -38,16 +38,21 @@ function press_it() {
 	$content = isset($_POST['content']) ? $_POST['content'] : '';
 
 	$upload = false;
-	if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) {
-		foreach( (array) $_POST['photo_src'] as $key => $image) {
+	if ( ! empty( $_POST['photo_src'] ) && current_user_can( 'upload_files' ) ) {
+		foreach ( (array) $_POST['photo_src'] as $key => $image) {
 			// see if files exist in content - we don't want to upload non-used selected files.
-			if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) {
-				$desc = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : '';
-				$upload = media_sideload_image($image, $post_ID, $desc);
+			if ( strpos( $_POST['content'], htmlspecialchars( $image ) ) !== false ) {
+				$desc          = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : '';
+				$attachment_id = media_handle_sideload( $image, $post_ID, $desc );
 
 				// Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes
-				if ( !is_wp_error($upload) )
-					$content = preg_replace('/<img ([^>]*)src=\\\?(\"|\')'.preg_quote(htmlspecialchars($image), '/').'\\\?(\2)([^>\/]*)\/*>/is', $upload, $content);
+				if ( ! is_wp_error( $attachment_id ) ) {
+					$content = preg_replace(
+						'/<img ([^>]*)src=\\\?(\"|\')' . preg_quote( htmlspecialchars( $image ), '/' ) . '\\\?(\2)([^>\/]*)\/*>/is',
+						wp_get_attachment_image( $attachment_id, 'full' ),
+						$content
+					);
+				}
 			}
 		}
 	}
diff --git tests/phpunit/tests/media.php tests/phpunit/tests/media.php
index 5983cbd..f948c21 100644
--- tests/phpunit/tests/media.php
+++ tests/phpunit/tests/media.php
@@ -438,4 +438,38 @@ VIDEO;
 		$this->assertTrue( has_image_size( 'test-size' ) );
 	}
 
+	/**
+	 * @ticket 19629
+	 */
+	function test_sideload_media() {
+
+		$post_id = wp_insert_post( array(
+			'post_title'  => 'test sideload media post',
+			'post_status' => 'publish'
+		) );
+
+		// Test sideloading image.
+		// Note source image has to be 'external'
+		$url = 'https://s.w.org/about/images/logos/wordpress-logo-notext-rgb.png';
+		$id = media_handle_sideload( $url, $post_id );
+		$this->assertTrue( is_int( $id ) );
+		wp_delete_attachment( $id, true );
+
+		// Test sideloading image by passing file array.
+		// Note source image has to be 'external'
+		$url = 'https://s.w.org/about/images/logos/wordpress-logo-notext-rgb.png';
+		$id = media_handle_sideload( array( 'name' => 'test.png', 'tmp_name' => download_url( $url ) ), $post_id );
+		$this->assertTrue( is_int( $id ) );
+		wp_delete_attachment( $id, true );
+
+		// Test sideloading 404.
+		$url = 'http://example.org/test-image-not-found.png';
+		$id = media_handle_sideload( $url, $post_id );
+		$this->assertTrue( is_wp_error( $id ) );
+
+		// Cleanup.
+		wp_delete_post( $post_id, true );
+
+	}
+
 }
