Reputation: 31
I am trying to add multiple images by using Laravel and it works fine by using the following command.
<input type="file" id="images" name="images[]" onchange="preview_image();" multiple accept="image/*"><br/>
<div id="image_preview"></div>
<script>
function preview_image()
{
var total_file=document.getElementById("images").files.length;
for(var i=0;i<total_file;i++)
{
$('#image_preview').append("<img src='"+URL.createObjectURL(event.target.files[i])+"'>");
}
}
</script>
but when i try to add more images, input file list clear and add the new list. I want to know how to keep the old files when i add new files.
Upvotes: 1
Views: 125