diff options
author | Pellaeon Lin <nfsmwlin@gmail.com> | 2013-12-08 23:17:35 +0800 |
---|---|---|
committer | Pellaeon Lin <nfsmwlin@gmail.com> | 2013-12-08 23:17:35 +0800 |
commit | 64bf0fa47fe4c623672cf86e831f66974e7f650c (patch) | |
tree | abbaaaa9ddf3f1d157be0d543ec65672b03c9cc5 /apps/files | |
parent | fc607e6bce76e9e2f6f52421bdddece951f629cd (diff) | |
download | nextcloud-server-64bf0fa47fe4c623672cf86e831f66974e7f650c.tar.gz nextcloud-server-64bf0fa47fe4c623672cf86e831f66974e7f650c.zip |
Display different messages for uploadLimit and freeSpace
Diffstat (limited to 'apps/files')
-rw-r--r-- | apps/files/index.php | 4 | ||||
-rw-r--r-- | apps/files/js/file-upload.js | 10 | ||||
-rw-r--r-- | apps/files/templates/index.php | 5 |
3 files changed, 15 insertions, 4 deletions
diff --git a/apps/files/index.php b/apps/files/index.php index 8f6838aa0d9..4ea0f9f2496 100644 --- a/apps/files/index.php +++ b/apps/files/index.php @@ -103,6 +103,8 @@ if ($needUpgrade) { } else { // information about storage capacities $storageInfo=OC_Helper::getStorageInfo($dir); + $freeSpace=OCP\Util::freeSpace($dir); + $uploadLimit=OCP\Util::uploadLimit(); $maxUploadFilesize=OCP\Util::maxUploadFilesize($dir); $publicUploadEnabled = \OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes'); // if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code) @@ -136,6 +138,8 @@ if ($needUpgrade) { $tmpl->assign('trashEmpty', $trashEmpty); $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); $tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); + $tmpl->assign('freeSpace', $freeSpace); + $tmpl->assign('uploadLimit', $uploadLimit); $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true))); $tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']); $tmpl->assign('isPublic', false); diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js index 979bb74b13f..7bd0eb81f57 100644 --- a/apps/files/js/file-upload.js +++ b/apps/files/js/file-upload.js @@ -233,11 +233,17 @@ $(document).ready(function() { // add size selection.totalBytes += file.size; - //check max upload size - if (selection.totalBytes > $('#max_upload').val()) { + // check PHP upload limit + if (selection.totalBytes > $('#upload_limit').val()) { data.textStatus = 'sizeexceedlimit'; data.errorThrown = t('files', 'File size exceeds upload limit'); } + + // check free space + if (selection.totalBytes > $('#free_space').val()) { + data.textStatus = 'notenoughspace'; + data.errorThrown = t('files', 'Not enough free space'); + } // end upload for whole selection on error if (data.errorThrown) { diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php index 00ec109621f..3d8a7f78e41 100644 --- a/apps/files/templates/index.php +++ b/apps/files/templates/index.php @@ -15,9 +15,10 @@ <div id="upload" class="button" title="<?php p($l->t('Upload') . ' max. '.$_['uploadMaxHumanFilesize']) ?>"> <?php if($_['uploadMaxFilesize'] >= 0):?> - <input type="hidden" name="MAX_FILE_SIZE" id="max_upload" - value="<?php p($_['uploadMaxFilesize']) ?>"> + <input type="hidden" name="MAX_FILE_SIZE" value="<?php p($_['uploadMaxFilesize']) ?>"> <?php endif;?> + <input type="hidden" id="upload_limit" value="<?php p($_['uploadLimit']) ?>"> + <input type="hidden" id="free_space" value="<?php p($_['freeSpace']) ?>"> <input type="hidden" class="max_human_file_size" value="(max <?php p($_['uploadMaxHumanFilesize']); ?>)"> <input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir"> |