EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: proceno72 on March 02, 2016, 08:10:58 AM



Title: Filebox multiple files
Post by: proceno72 on March 02, 2016, 08:10:58 AM
I'm using easyui-filebox plugin, but i can't select multiple files. How can I enable this feature?


Title: Re: Filebox multiple files
Post by: proceno72 on March 02, 2016, 10:08:55 AM
Ok, maybe i found a solution.
Code:
$('#fb').filebox({
   buttonText: 'Select...',
   onChange: function (newValue, oldValue) {
   // This to show all files list on the textbox (otherwise it shows only last selected file with the "fakepath" issue)
            var f = $('#fb').next().find('.textbox-value');
            var listfiles = '';
            $.each(f[0].files, function(index, item) {
                if (listfiles.length > 0) { listfiles = listfiles + ', '+ '"'+item.name+'"'; }
                else { listfiles = '"'+item.name+'"'; }
            });
            $(this).textbox('setText',listfiles);
   }
});

// This to set the right property "multiple" on the input file tag
$('#fb').next().find('.textbox-value').prop('multiple',true);