Index: wp-admin/includes/class-wp-upgrader.php
===================================================================
--- wp-admin/includes/class-wp-upgrader.php	(revision 11473)
+++ wp-admin/includes/class-wp-upgrader.php	(working copy)
@@ -720,7 +720,7 @@
 		return $this->__construct($args);
 	}
 	function __construct($args = array()) {
-		$defaults = array( 'url' => '', 'nonce' => '', 'title' => '' );
+		$defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
 		$this->options = wp_parse_args($args, $defaults);
 	}
 
@@ -734,9 +734,10 @@
 
 	function request_filesystem_credentials($error = false) {
 		$url = $this->options['url'];
+		$context = $this->options['context'];
 		if ( !empty($this->options['nonce']) )
 			$url = wp_nonce_url($url, $this->options['nonce']);
-		return request_filesystem_credentials($url, '', $error); //Possible to bring inline, Leaving as0is for now.
+		return request_filesystem_credentials($url, '', $error, $context); //Possible to bring inline, Leaving as is for now.
 	}
 
 	function header() {
Index: wp-admin/includes/file.php
===================================================================
--- wp-admin/includes/file.php	(revision 11473)
+++ wp-admin/includes/file.php	(working copy)
@@ -583,12 +583,12 @@
  * @param unknown_type $args
  * @return unknown
  */
-function WP_Filesystem( $args = false ) {
+function WP_Filesystem( $args = false, $context = false ) {
 	global $wp_filesystem;
 
 	require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
 
-	$method = get_filesystem_method($args);
+	$method = get_filesystem_method($args, $context);
 
 	if ( ! $method )
 		return false;
@@ -623,13 +623,16 @@
  * @since unknown
  *
  * @param unknown_type $args
+ * @param string $context Full path to the directory that is tested for being writable.
  * @return unknown
  */
-function get_filesystem_method($args = array()) {
+function get_filesystem_method($args = array(), $context = false) {
 	$method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets'
 
 	if( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){
-		$temp_file_name = ABSPATH . '.' . time();
+		if ( !$context )
+			$context = WP_CONTENT_DIR;
+		$temp_file_name = $context . '.write-test-' . time();
 		$temp_handle = @fopen($temp_file_name, 'w');
 		if ( $temp_handle ) {
 			if ( getmyuid() == fileowner($temp_file_name) )
@@ -655,13 +658,13 @@
  * @param unknown_type $error
  * @return unknown
  */
-function request_filesystem_credentials($form_post, $type = '', $error = false) {
-	$req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);
+function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false) {
+	$req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error, $context);
 	if ( '' !== $req_cred )
 		return $req_cred;
 
 	if ( empty($type) )
-		$type = get_filesystem_method();
+		$type = get_filesystem_method(array(), $context);
 
 	if ( 'direct' == $type )
 		return true;
Index: wp-admin/update-core.php
===================================================================
--- wp-admin/update-core.php	(revision 11473)
+++ wp-admin/update-core.php	(working copy)
@@ -142,7 +142,7 @@
 	else
 		$url = 'update-core.php?action=do-core-upgrade';
 	$url = wp_nonce_url($url, 'upgrade-core');
-	if ( false === ($credentials = request_filesystem_credentials($url)) )
+	if ( false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH)) )
 		return;
 
 	$version = isset( $_POST['version'] )? $_POST['version'] : false;
@@ -152,8 +152,8 @@
 		return;
 
 
-	if ( ! WP_Filesystem($credentials) ) {
-		request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
+	if ( ! WP_Filesystem($credentials, ABSPATH) ) {
+		request_filesystem_credentials($url, '', true, ABSPATH); //Failed to connect, Error and request again
 		return;
 	}
 ?>
