When this is the case only the configured max upload size is taking into account for uploading
foreach ($files['size'] as $size) {
$totalSize += $size;
}
-if ($totalSize > \OC\Files\Filesystem::free_space($dir)) {
+if ($totalSize > $maxUploadFilesize) {
OCP\JSON::error(array('data' => array('message' => $l->t('Not enough storage available'),
'uploadMaxFilesize' => $maxUploadFilesize,
'maxHumanFilesize' => $maxHumanFilesize)));
return false;
}
- public function free_space($path) {
- // Infinite?
- return false;
- }
-
public function touch($path, $mtime = null) {
if (is_null($mtime)) {
$mtime = time();
}
}
- public function free_space($path) {
- return -1;
- }
-
public function touch($path, $mtime=null) {
try {
if (!is_null($mtime)) return false;
return fopen($this->constructUrl($path), $mode);
}
- public function free_space($path) {
- return 0;
- }
-
public function touch($path, $mtime=null) {
$this->init();
if(is_null($mtime)) {
}
}
- public function free_space($path) {
- return 1024*1024*1024*8;
- }
-
public function touch($path, $mtime=null) {
$this->init();
$obj=$this->getObject($path);
return 0;
}
} catch(\Exception $e) {
- return 0;
+ return \OC\Files\FREE_SPACE_UNKNOWN;
}
}
namespace OC\Files;
+const FREE_SPACE_UNKNOWN = -2;
+
class Filesystem {
public static $loaded = false;
/**
}
return implode('/', $output);
}
+
+ /**
+ * get the free space in the storage
+ * @param $path
+ * return int
+ */
+ public function free_space($path){
+ return \OC\Files\FREE_SPACE_UNKNOWN;
+ }
}
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
$freeSpace = \OC\Files\Filesystem::free_space($dir);
- $freeSpace = max($freeSpace, 0);
+ if($freeSpace !== \OC\Files\FREE_SPACE_UNKNOWN){
+ $freeSpace = max($freeSpace, 0);
- return min($maxUploadFilesize, $freeSpace);
+ return min($maxUploadFilesize, $freeSpace);
+ } else {
+ return $maxUploadFilesize;
+ }
}
/**