I have created my own fileuploader base on magento component. I want to check file number when it reach to limit

function (
) {
    return UpLoader.extend({
        defaults: {
            template: 'uploader/uploader',
            previewTmpl: 'uploader/preview',
            isMultipleFiles : true,
            inputName: 'image',
            uploaderConfig: {
                dataType: 'json',
                sequentialUploads: true,
                formData: {
                    'form_key': window.FORM_KEY
            links: {
                value: '${ $.parentName }:uploadValue'

        //more functions here
        Parent file have lot functions here

         * This is my constructor
         * Invokes initialize method of parent class,
         * contains initialization logic
        initialize: function () {
            _.bindAll(this, 'reset');

            return this;

         *  Retrieve max number file allow in configuration
        getMaxFileNumber: function() {
            return this.uploaderConfig.maxFileNumber;

Is there a good way to check and return alert message when user number file uploaded reach to limit

1 Answer 1


Maybe someone will need, i will post my temporary solution here

onFilesChoosed: function () {
    var files = this.value();
    if (files.length >= this.getMaxFileNumber()) {
        alert("Max files exceeded, You can't upload more!");
        return false;
    return this;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.