How to add remove button here like simple remove one by one in files queue like this
The reason why im not using free file upload plugins w
I've done this before for my Dropzone. Feel free to adjust. This is from my Laravel app. You should focus on avatar_refresh_upload. Cut off unnecessary stuff and you're done.
function avatar_refresh_upload() {
var input = $('input#avatar[type=file]');
input.replaceWith(input.val('').clone(true));
$('#selected_file').html('{{ Lang::get('app.profile_avatar_select') }}');
$('#avatar_refresh_upload').removeAttr('style');
}
$(document).ready(function ($) {
$('input:file#avatar').change(function () {
var file_name = $(this).val();
if (file_name.length > 10) {
file_name = file_name.substring(0, 10) + '...';
}
$('#selected_file').html('File "' + file_name + '" chosen');
$('#avatar_refresh_upload').css('display', 'inline-block');
});
$('#avatar_refresh_upload').on('click', function () {
avatar_refresh_upload();
});
@if ($user->avatar != '')
$('#remove_avatar').change(function () {
if ($(this).is(':checked')) {
avatar_refresh_upload();
$('#avatar').prop('disabled', true);
$('#avatar_preview').css('opacity', '0.5');
$('#avatar_upload_form_area').css('opacity', '0.5');
$('#remove_avatar_info').show();
} else {
$('#avatar').prop('disabled', false);
$('#avatar_preview').removeAttr('style');
$('#avatar_upload_form_area').removeAttr('style');
$('#remove_avatar_info').removeAttr('style');
}
});
@endif
});
Making long story short - if you want to reset input file after you picked a file for upload but before submitting, you have to run:
input.replaceWith(input.val('').clone(true));