diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php
index eaff28178eaf1341c8e8abf587af6a320eb5887a..87939d269214a2084fcf8c5278394cb27a562374 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,
 					 'usedSpacePercent'  => (int)$storageInfo['relative']);
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 1c8d01c141fda4d9cd7e844f29fa8252a44e5808..12784c9a5eb1f7123199a39cbe133a7b2af16871 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -824,13 +824,16 @@ 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
+	 * @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) {
+	public static function maxUploadFilesize($dir, $freeSpace = null) {
 		$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
 		$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
-		$freeSpace = \OC\Files\Filesystem::free_space($dir);
+		if (is_null($freeSpace)) {
+			$freeSpace = \OC\Files\Filesystem::free_space($dir);
+		}
 		if ((int)$upload_max_filesize === 0 and (int)$post_max_size === 0) {
 			$maxUploadFilesize = \OC\Files\SPACE_UNLIMITED;
 		} elseif ((int)$upload_max_filesize === 0 or (int)$post_max_size === 0) {
diff --git a/lib/public/util.php b/lib/public/util.php
index 6317f10a66f06bee2a502b4469fab71e359c3f11..52874bcc95474adce0af2f7d1580f316cff6e01a 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -456,10 +456,11 @@ 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);
 	}
 }