mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 10:06:53 +08:00
14 lines
460 B
JavaScript
14 lines
460 B
JavaScript
/* eslint no-unused-vars: "off" */
|
|
/* global I18n GLOBAL_CONSTANTS HelperModule*/
|
|
|
|
function validateFileSize(file, showErrorMessage = false) {
|
|
var validSize = true;
|
|
if (file.size > GLOBAL_CONSTANTS.FILE_MAX_SIZE_MB * 1024 * 1024) {
|
|
validSize = false;
|
|
}
|
|
|
|
if (!validSize && showErrorMessage) {
|
|
HelperModule.flashAlertMsg(I18n.t('general.file.size_exceeded', { file_size: GLOBAL_CONSTANTS.FILE_MAX_SIZE_MB }), 'danger');
|
|
}
|
|
return validSize;
|
|
}
|