Allows to call html input file dialogue from any html element and dynamically add files to html form. Written in native JavaScript+JQuery with no Flash or other third-party libraries.
Requires jQuery library
Simply connect al.multiplefile.*.js after jQuery, then bind it on any DOM object (for ex. button):
$('.btn').multipleFile({
maxFiles: 4, //files limit
accept: '.doc,.docx', //accepting extensions
maxFileSize: 5*1024*1024, //max file size
onInitSuccess: function(){ //called when mltipleFiles initialized
console.log('MultipleFile plugin initialized successfully!');
},
});
This code creates an instance of multipleFile on .btn object, sets the files limit up to 4 (maximal file size of each not higher than 5*1024*1024 bytes) and acceptable extensions to .doc and .docx. You can also use MIME-types of acceptable file extensions in the same context (combining simplified file extensions with MIME-types, e.g. accept: 'image/png,.jpg'
- makes differences in different browsers).