checking for file size > 2GB
included global MAXFILESIZE
This commit is contained in:
parent
0f8c3caf18
commit
9501c1ce4b
2 changed files with 8 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
|
.idea
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
/* global MAXFILESIZE */
|
||||||
const html = require('choo/html');
|
const html = require('choo/html');
|
||||||
const assets = require('../../common/assets');
|
const assets = require('../../common/assets');
|
||||||
const fileList = require('./fileList');
|
const fileList = require('./fileList');
|
||||||
const { fadeOut } = require('../utils');
|
const { bytes, fadeOut } = require('../utils');
|
||||||
|
|
||||||
module.exports = function(state, emit) {
|
module.exports = function(state, emit) {
|
||||||
const div = html`
|
const div = html`
|
||||||
|
@ -64,6 +65,11 @@ module.exports = function(state, emit) {
|
||||||
if (file.size === 0) {
|
if (file.size === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (file.size > MAXFILESIZE) {
|
||||||
|
window.alert(state.translate('fileTooBig', { size: bytes(MAXFILESIZE) }));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await fadeOut('page-one');
|
await fadeOut('page-one');
|
||||||
emit('upload', { file, type: 'click' });
|
emit('upload', { file, type: 'click' });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue