diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php
index 21d1f50e5873b69c1fab71477f381865ffda9b5f..01fc65d76b74444a8d4c18801557250dc1502012 100644
--- a/apps/files/lib/helper.php
+++ b/apps/files/lib/helper.php
@@ -5,14 +5,14 @@ namespace OCA\Files;
 class Helper
 {
 	public static function buildFileStorageStatistics($dir) {
+		// information about storage capacities
+		$storageInfo = \OC_Helper::getStorageInfo($dir);
+
 		$l = new \OC_L10N('files');
-		$maxUploadFilesize = \OCP\Util::maxUploadFilesize($dir);
+		$maxUploadFilesize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']);
 		$maxHumanFilesize = \OCP\Util::humanFileSize($maxUploadFilesize);
 		$maxHumanFilesize = $l->t('Upload') . ' max. ' . $maxHumanFilesize;
 
-		// information about storage capacities
-		$storageInfo = \OC_Helper::getStorageInfo($dir);
-
 		return array('uploadMaxFilesize' => $maxUploadFilesize,
 					 'maxHumanFilesize'  => $maxHumanFilesize,
 					 'freeSpace' => $storageInfo['free'],
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 580f81acc6259c7287cf4e0d3751930544ee93d8..58cb1b88d6690fee4f1c35912a655cd04934fa66 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -804,18 +804,22 @@ class OC_Helper {
 	/**
 	 * @brief calculates the maximum upload size respecting system settings, free space and user quota
 	 *
-	 * @param $dir the current folder where the user currently operates
-	 * @return number of bytes representing
+	 * @param string $dir the current folder where the user currently operates
+	 * @param int $freeSpace the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly
+	 * @return int number of bytes representing
 	 */
-	public static function maxUploadFilesize($dir) {
-		return min(self::freeSpace($dir), self::uploadLimit());
+	public static function maxUploadFilesize($dir, $freeSpace = null) {
+		if (is_null($freeSpace)){
+			$freeSpace = self::freeSpace($dir);
+		}
+		return min($freeSpace, self::uploadLimit());
 	}
 
 	/**
 	 * Calculate free space left within user quota
 	 * 
-	 * @param $dir the current folder where the user currently operates
-	 * @return number of bytes representing
+	 * @param string $dir the current folder where the user currently operates
+	 * @return int number of bytes representing
 	 */
 	public static function freeSpace($dir) {
 		$freeSpace = \OC\Files\Filesystem::free_space($dir);
diff --git a/lib/public/util.php b/lib/public/util.php
index d8497e29cfc076c4d3eab6cc99dc13ef8c2c9ee1..4611e5e2650381fbf7577fd5467a73640f6989e6 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -460,11 +460,12 @@ class Util {
 	/**
 	 * calculates the maximum upload size respecting system settings, free space and user quota
 	 *
-	 * @param $dir the current folder where the user currently operates
+	 * @param string $dir the current folder where the user currently operates
+	 * @param int $free the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly
 	 * @return number of bytes representing
 	 */
-	public static function maxUploadFilesize($dir) {
-		return \OC_Helper::maxUploadFilesize($dir);
+	public static function maxUploadFilesize($dir, $free = null) {
+		return \OC_Helper::maxUploadFilesize($dir, $free);
 	}
 
 	/**