I did the implementation of this task, but with the limitation on amount of files. All you need to do is to predefined some set of inputs[type=”file”] in plugin’s admin, something like these:
<p class="hide">[file file-01]</p>
<p class="hide">[file file-02]<a class="del_file" href="#">del</a></p>
<p class="hide">[file file-03]<a class="del_file" href="#">del</a></p>
<p class="hide">[file file-04]<a class="del_file" href="#">del</a></p>
<p class="hide">[file file-05]<a class="del_file" href="#">del</a></p>
<a href="#" class="add_file">Add file</a>
As you can see, we have 5 inputs and a links to add and delete. Also I added some markup. Then we need to make some functionality with the help of jQuery. Something like these:
jQuery(document).ready(function(){
//hide all inputs except the first one
$('p.hide').not(':eq(0)').hide();
//functionality for add-file link
$('a.add_file').on('click', function(e){
//show by click the first one from hidden inputs
$('p.hide:not(:visible):first').show('slow');
e.preventDefault();
});
//functionality for del-file link
$('a.del_file').on('click', function(e){
//var init
var input_parent = $(this).parent();
var input_wrap = input_parent.find('span');
//reset field value
input_wrap.html(input_wrap.html());
//hide by click
input_parent.hide('slow');
e.preventDefault();
});
});
Working example you can see here (form to add auto).