Index: src/wp-admin/includes/file.php
===================================================================
--- src/wp-admin/includes/file.php	(revision 25767)
+++ src/wp-admin/includes/file.php	(working copy)
@@ -601,6 +601,8 @@
 	if ( true !== $zopen )
 		return new WP_Error('incompatible_archive', __('Incompatible Archive.'));
 
+	$uncompressed_size = 0;
+
 	for ( $i = 0; $i < $z->numFiles; $i++ ) {
 		if ( ! $info = $z->statIndex($i) )
 			return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
@@ -608,12 +610,18 @@
 		if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Skip the OS X-created __MACOSX directory
 			continue;
 
+		$uncompressed_size += $info['size'];
+
 		if ( '/' == substr($info['name'], -1) ) // directory
 			$needed_dirs[] = $to . untrailingslashit($info['name']);
 		else
 			$needed_dirs[] = $to . untrailingslashit(dirname($info['name']));
 	}
 
+	$available_space = disk_free_space( WP_CONTENT_DIR );
+	if ( $uncompressed_size > $available_space )
+		return new WP_Error( 'disk_full_preupgrade', sprintf( __( "There isn't enough disk space available at present to update WordPress. WordPress requires at least %s disk space, and you unfortunately only have %s available." ), size_format( $uncompressed_size ), size_format( $available_space ) ) );
+
 	$needed_dirs = array_unique($needed_dirs);
 	foreach ( $needed_dirs as $dir ) {
 		// Check the parent folders of the folders all exist within the creation array.
@@ -693,14 +701,22 @@
 	if ( 0 == count($archive_files) )
 		return new WP_Error( 'empty_archive_pclzip', __( 'Empty archive.' ) );
 
+	$uncompressed_size = 0;
+
 	// Determine any children directories needed (From within the archive)
 	foreach ( $archive_files as $file ) {
 		if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Skip the OS X-created __MACOSX directory
 			continue;
 
+		$uncompressed_size += $file['size'];
+
 		$needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname($file['filename']) );
 	}
 
+	$available_space = disk_free_space( WP_CONTENT_DIR );
+	if ( $uncompressed_size > $available_space )
+		return new WP_Error( 'disk_full_preupgrade', sprintf( __( "There isn't enough disk space available at present to update WordPress. WordPress requires at least %s disk space, and you unfortunately only have %s available." ), size_format( $uncompressed_size ), size_format( $available_space ) ) );
+
 	$needed_dirs = array_unique($needed_dirs);
 	foreach ( $needed_dirs as $dir ) {
 		// Check the parent folders of the folders all exist within the creation array.
