Topic: Removing files from #filelist (custom example) kills "browse" (flash)

Hi guys!

I have a problem with "custom" example (http://www.plupload.com/example_custom.php) in flash mode.

I slightly modified it to add removal functionality when clicking on filename. So the modified part now looks like this

uploader.bind('Init', function(up, params) {
    $('#filelist')[0].innerHTML = "<div>Current runtime: " + params.runtime + "</div>";
});

uploader.bind('FilesAdded', function(up, files) {
    for (var i in files) {
        $('#filelist')[0].innerHTML += '<div class="file" id="' + files[i].id + '">' + files[i].name + ' (' + plupload.formatSize(files[i].size) + ') <b></b></div>';
    }
});

uploader.init();

$('#container').on('click', '.file', function() {
    var id = $(this).attr('id'), file, i;
    for (i in uploader.files) {
        file = uploader.files[i];
        if (file.id === id) {
            uploader.removeFile(file);
            $(this).remove();
        }
    }
});

Please note I used jQuery to handle clicks.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

As soon as I click on filename the "browse" button stops working. I can't figure out why. It works fine in HTML mode, but in Flash mode it fails.

Am I doing something wrong?

Thanks in advance.

Re: Removing files from #filelist (custom example) kills "browse" (flash)

try putting "uploader.refresh()" after the deletion

uploader.removeFile(file);
$(this).remove();
uploader.refresh();

Re: Removing files from #filelist (custom example) kills "browse" (flash)

Thanks for your help. It works now