How to use the select.zip.file.to.upload function in select

To help you get started, we’ve selected a few select examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wso2 / carbon-dashboards / apps / portal / js / upload-asset.js View on Github external
var validateAssetUpload = function () {
        var selectFileElement = $("#selected-file");
        var uploadErrorElement = $("#upload-error");
        var assetFile = selectFileElement[0].files[0];
        var zipFileType = "application/zip";
        var bytesToMB = 1048576;
        var fileSizeLimit = (window.location.pathname.indexOf("gadget") > -1) ? config.assets.gadget.fileSizeLimit : config.assets.layout.fileSizeLimit;

        if (!assetFile) {
            showInlineError(selectFileElement, uploadErrorElement, i18n_data_json["select.zip.file.to.upload"]);
            return;
        } else if (assetFile.type !== zipFileType) {
            showInlineError(selectFileElement, uploadErrorElement, i18n_data_json["select.zip.file.to.upload"] + " " +
                assetFile.type + " " + i18n_data_json["file.format.is.not.supported"]);
            return;
        } else if (assetFile.size / bytesToMB > fileSizeLimit) {
            showInlineError(selectFileElement, uploadErrorElement, i18n_data_json["file.size.exceeded"]);
            return;
        }
        return true;
    };
github wso2 / carbon-dashboards / apps / portal / js / upload-asset.js View on Github external
var validateAssetUpload = function () {
        var selectFileElement = $("#selected-file");
        var uploadErrorElement = $("#upload-error");
        var assetFile = selectFileElement[0].files[0];
        var zipFileType = "application/zip";
        var bytesToMB = 1048576;
        var fileSizeLimit = (window.location.pathname.indexOf("gadget") > -1) ? config.assets.gadget.fileSizeLimit : config.assets.layout.fileSizeLimit;

        if (!assetFile) {
            showInlineError(selectFileElement, uploadErrorElement, i18n_data_json["select.zip.file.to.upload"]);
            return;
        } else if (assetFile.type !== zipFileType) {
            showInlineError(selectFileElement, uploadErrorElement, i18n_data_json["select.zip.file.to.upload"] + " " +
                assetFile.type + " " + i18n_data_json["file.format.is.not.supported"]);
            return;
        } else if (assetFile.size / bytesToMB > fileSizeLimit) {
            showInlineError(selectFileElement, uploadErrorElement, i18n_data_json["file.size.exceeded"]);
            return;
        }
        return true;
    };

select

Programmatically select the text of a HTML element

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis