I have a file upload option on a form I have built with .NET MVC.
I have the following JavaScript that lists out the selected files in my fileList div.
updateList = function () {
var input = document.getElementById('file');
var output = document.getElementById('fileList');
output.innerHTML = '<ul>';
for (var i = 0; i < input.files.length; ++i) {
output.innerHTML += '<li>' + input.files.item(i).name + '<a onclick="removeFile()" href="javascript:void(0);">remove</a>' + '</li>';
}
output.innerHTML += '</ul>';
}
Next to each file I am printing the 'remove' text that will call a function named removeFile.
From here I am stuck, how would I remove the specific file from my list? Any help would be appreciated!