I want users to upload multiple files in PHP.
HTML
<input name="file[]" type="file" class="multi_files" style="margin: 0px 0px 15px;" />
<button class="add_more">Add More Files</button>
When the user selects a file, I need to display a button Add more file. Otherwise, hide the button. When loading the page, I make the button with the class #add_morehidden via jquery.Initially, when the first file is loaded, add another button to get display.This works fine. Starting from the second case, I need to show add moreonly when downloading the next file. help me
$('input:file.multi_files').change(
function(){
$('input:file').removeClass('multi_files');
if ($(this).val()) {
$('.add_more').show();
}
else
{
$('.add_more').hide();
}
}
);
$('.add_more').click(function(e){
e.preventDefault();
if($(this).closest('input:file').val())
{
$(this).before("<input name='file[]' type='file' class='multi_files'/>");
}
});
I also need to add a delete button for each file.

Techy source
share