Show max upload size before trying to upload

pull/1/head
yflory 4 years ago
parent 3262456b8a
commit e83f15fe14

@ -124,6 +124,18 @@ define([
var $pb = $row.find('.cp-fileupload-table-progressbar');
var $link = $row.find('.cp-fileupload-table-link');
var privateData = common.getMetadataMgr().getPrivateData();
var l = privateData.plan ? ApiConfig.premiumUploadSize : false;
l = l || ApiConfig.maxUploadSize || "?";
var maxSizeStr = Util.bytesToMegabytes(l);
if (blob && blob.byteLength && typeof(l) === "number" && blob.byteLength > l) {
$pv.text(Messages.error);
queue.inProgress = false;
queue.next();
return void UI.alert(Messages._getKey('upload_tooLargeBrief', [maxSizeStr]));
}
/**
* Update progress in the download panel, for uploading a file
* @param {number} progressValue Progression of download, between 0 and 100
@ -167,10 +179,6 @@ define([
if (config.onError) { config.onError(e); }
if (e === 'TOO_LARGE') {
var privateData = common.getMetadataMgr().getPrivateData();
var l = privateData.plan ? ApiConfig.premiumUploadSize : false;
l = l || ApiConfig.maxUploadSize || '?';
var maxSizeStr = Util.bytesToMegabytes(l);
$pv.text(Messages.error);
return void UI.alert(Messages._getKey('upload_tooLargeBrief', [maxSizeStr]));
}

Loading…
Cancel
Save