Don't block uploads if the max upload size is unknown
This commit is contained in:
parent
32b8fd8fb7
commit
319e3f162c
|
@ -23,8 +23,10 @@
|
||||||
method="post"
|
method="post"
|
||||||
enctype="multipart/form-data"
|
enctype="multipart/form-data"
|
||||||
target="file_upload_target_1">
|
target="file_upload_target_1">
|
||||||
|
<?php if($_['uploadMaxFilesize'] >= 0):?>
|
||||||
<input type="hidden" name="MAX_FILE_SIZE" id="max_upload"
|
<input type="hidden" name="MAX_FILE_SIZE" id="max_upload"
|
||||||
value="<?php p($_['uploadMaxFilesize']) ?>">
|
value="<?php p($_['uploadMaxFilesize']) ?>">
|
||||||
|
<?php endif;?>
|
||||||
<!-- Send the requesttoken, this is needed for older IE versions
|
<!-- Send the requesttoken, this is needed for older IE versions
|
||||||
because they don't send the CSRF token via HTTP header in this case -->
|
because they don't send the CSRF token via HTTP header in this case -->
|
||||||
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken">
|
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken">
|
||||||
|
|
|
@ -764,7 +764,8 @@ class OC_Helper {
|
||||||
public static function maxUploadFilesize($dir) {
|
public static function maxUploadFilesize($dir) {
|
||||||
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
|
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
|
||||||
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
|
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
|
||||||
if ($upload_max_filesize === 0 and $post_max_size === 0) {
|
$freeSpace = \OC\Files\Filesystem::free_space($dir);
|
||||||
|
if ($upload_max_filesize == 0 and $post_max_size == 0) {
|
||||||
$maxUploadFilesize = \OC\Files\FREE_SPACE_UNLIMITED;
|
$maxUploadFilesize = \OC\Files\FREE_SPACE_UNLIMITED;
|
||||||
} elseif ($upload_max_filesize === 0 or $post_max_size === 0) {
|
} elseif ($upload_max_filesize === 0 or $post_max_size === 0) {
|
||||||
$maxUploadFilesize = max($upload_max_filesize, $post_max_size); //only the non 0 value counts
|
$maxUploadFilesize = max($upload_max_filesize, $post_max_size); //only the non 0 value counts
|
||||||
|
@ -772,7 +773,6 @@ class OC_Helper {
|
||||||
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
|
$maxUploadFilesize = min($upload_max_filesize, $post_max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
$freeSpace = \OC\Files\Filesystem::free_space($dir);
|
|
||||||
if($freeSpace !== \OC\Files\FREE_SPACE_UNKNOWN){
|
if($freeSpace !== \OC\Files\FREE_SPACE_UNKNOWN){
|
||||||
$freeSpace = max($freeSpace, 0);
|
$freeSpace = max($freeSpace, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue