Index: wp-admin/includes/class-wp-filesystem-ftpsockets.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-ftpsockets.php	(revision 2610)
+++ wp-admin/includes/class-wp-filesystem-ftpsockets.php	(working copy)
@@ -135,6 +135,12 @@
 		fwrite($temphandle, $contents);
 		fseek($temphandle, 0); //Skip back to the start of the file being written to
 
+		$dir = dirname($file);
+		$file = basename($file);
+		if ( $dir && $dir != '.' ) {
+			$dir = $this->find_folder($dir);
+			$this->chdir($dir);
+		}
 		$ret = $this->ftp->fput($file, $temphandle);
 
 		fclose($temphandle);
Index: wp-admin/includes/class-wp-upgrader.php
===================================================================
--- wp-admin/includes/class-wp-upgrader.php	(revision 2610)
+++ wp-admin/includes/class-wp-upgrader.php	(working copy)
@@ -323,7 +323,7 @@
 			// Create maintenance file to signal that we are upgrading
 			$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
 			$wp_filesystem->delete($file);
-			$wp_filesystem->put_contents($file, $maintenance_string, FS_CHMOD_FILE);
+			$wp_filesystem->put_contents($file, $maintenance_string);
 		} else if ( !$enable && $wp_filesystem->exists($file) ) {
 			$this->skin->feedback('maintenance_end');
 			$wp_filesystem->delete($file);
Index: wp-admin/includes/update-core.php
===================================================================
--- wp-admin/includes/update-core.php	(revision 2610)
+++ wp-admin/includes/update-core.php	(working copy)
@@ -223,7 +223,7 @@
 	$maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
 	$maintenance_file = $to . '.maintenance';
 	$wp_filesystem->delete($maintenance_file);
-	$wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE);
+	$wp_filesystem->put_contents($maintenance_file, $maintenance_string);
 
 	// Copy new versions of WP files into place.
 	$result = copy_dir($from . '/wordpress', $to);
Index: wp-admin/includes/class-wp-filesystem-ftpext.php
===================================================================
--- wp-admin/includes/class-wp-filesystem-ftpext.php	(revision 2610)
+++ wp-admin/includes/class-wp-filesystem-ftpext.php	(working copy)
@@ -122,6 +122,12 @@
 		fwrite($temp, $contents);
 		fseek($temp, 0); //Skip back to the start of the file being written to
 
+		$dir = dirname($file);
+		$file = basename($file);
+		if ( $dir && $dir != '.' ) {
+			$dir = $this->find_folder($dir);
+			$this->chdir($dir);
+		}
 		$ret = @ftp_fput($this->link, $file, $temp, $type);
 
 		fclose($temp);
@@ -134,7 +140,7 @@
 		return $cwd;
 	}
 	function chdir($dir) {
-		return @ftp_chdir($dir);
+		return @ftp_chdir($this->link, $dir);
 	}
 	function chgrp($file, $group, $recursive = false ) {
 		return false;
