removing item from array

removing item from array

hey guys...im trying to make a multi-file uploader...but am having a problem when trying to remove a item from an array if anyone can tell me why

here is my code

  1. <script>
    $(document).ready(function() {
        var max_uploads = 10;
        var uploads     = 0
        var files       = $('.input-file').prop("files");
        var file_count  = files.length;
           
        $('#input-file-button').click(function() {
            $('.input-file').click();
        });
       
        $('.input-file').change(function (){
           
            if (uploads < 10){
                uploads++;
                var file_name = $(this).val();
                var file_path = window.URL.createObjectURL(this.files[0]);
               
                if (uploads === 1){
                    $('#image-status').text(uploads + " Image selected. Add up to " + (max_uploads - uploads) + " more.");
                }
               
                if (uploads > 1){
                    $('#image-status').text(uploads + " Images selected. Add up to " + (max_uploads - uploads) + " more.");
                }
               
                $('#uploaded-images').append('<div id="overlay"><img class="selected-image" src="'+ file_path +'" /></div><div onclick="remove_image('+ uploads +')">remove</div>');   
            }   
        });
           
        if (file_count < 1)
        {
            $('#image-status').text("Add up to " + max_uploads + " images.");
        }

         
        function remove_image(id)
        {   
            files.splice( $.inArray(removeItem, id), 1 );
            uploads--;
        }
    });

    </script>

the problem im having is the onclick which isnt operating

  1. <div onclick="remove_image('+ uploads +')">remove</div>

and further on not removing the item from the array...any help on how to do this would be greatly appreciate...thank you