mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
issue error if file drop on drop area is > maxfilesize
This commit is contained in:
parent
12fc5c1185
commit
ccab32bb42
|
@ -1518,6 +1518,7 @@ function getOverallStatusIcon($status) { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
function printFileChooserJs() { /* {{{ */
|
||||
$maxfilesize = $this->getParam('maxfilesize');
|
||||
?>
|
||||
$(document).ready(function() {
|
||||
/* Triggered after the file has been selected */
|
||||
|
@ -1525,6 +1526,19 @@ $(document).ready(function() {
|
|||
var input = $(this),
|
||||
numFiles = input.get(0).files ? input.get(0).files.length : 1,
|
||||
label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
|
||||
<?php if($maxfilesize): ?>
|
||||
if(input.get(0).files[0].size > <?= $maxfilesize ?>) {
|
||||
noty({
|
||||
text: "<?= getMLText('uploading_maxsize') ?>",
|
||||
type: 'error',
|
||||
dismissQueue: true,
|
||||
layout: 'topRight',
|
||||
theme: 'defaultTheme',
|
||||
timeout: 1500,
|
||||
});
|
||||
return;
|
||||
}
|
||||
<?php endif; ?>
|
||||
input.trigger('fileselect', [numFiles, label]);
|
||||
});
|
||||
|
||||
|
|
|
@ -1510,6 +1510,7 @@ function getOverallStatusIcon($status) { /* {{{ */
|
|||
} /* }}} */
|
||||
|
||||
function printFileChooserJs() { /* {{{ */
|
||||
$maxfilesize = $this->getParam('maxfilesize');
|
||||
?>
|
||||
$(document).ready(function() {
|
||||
/* do not use bootstrap4 custom form element because it is difficult to localize
|
||||
|
@ -1525,6 +1526,19 @@ $(document).ready(function() {
|
|||
var input = $(this),
|
||||
numFiles = input.get(0).files ? input.get(0).files.length : 1,
|
||||
label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
|
||||
<?php if($maxfilesize): ?>
|
||||
if(input.get(0).files[0].size > <?= $maxfilesize ?>) {
|
||||
noty({
|
||||
text: "<?= getMLText('uploading_maxsize') ?>",
|
||||
type: 'error',
|
||||
dismissQueue: true,
|
||||
layout: 'topRight',
|
||||
theme: 'defaultTheme',
|
||||
timeout: 1500,
|
||||
});
|
||||
return;
|
||||
}
|
||||
<?php endif; ?>
|
||||
input.trigger('fileselect', [numFiles, label]);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user