File upload does not work in Firefox


I have been working on an online storage server via the web. I have developed all the functionality of the system using servlets and I have all file management working.

The problem is that the file upload does not work in the Firefox browser, it works in browsers like Safari or Chrome .

The functions of Javascript have only been implemented to show a UI more attractive than the ones offered by the HTML forms.

As I said, I would like to extend the functionality of uploading files to users of Firefox .


function validateForm() {
	var file = document.getElementById("file_to_upload");
	if (file.files.length == 0) {
		window.alert("Debe seleccionar un archivo para subir");
		return false;
function upload_alternative() {
	var upload = document.getElementById("upload");;
<form id="upload_form" method="POST" action="Upload" enctype="multipart/form-data"
    onsubmit="return validateForm()" >
    <input id="file_to_upload" type="file" name="file[]" multiple="multiple"
        onchange="javascript:upload_alternative()" />
    <input type="submit" value="Upload" name="upload" id="upload" />
asked by Delfin Hernandez Gomez 21.01.2017 в 17:17

1 answer


In browsers such as Chrome or Safari, when the closing of an HTML tag is omitted, the problem is handled by adding one to the end of the affected element. In browsers such as Firefox, this problem is solved by closing the next tag of the same class.

For this reason, firefox did not allow me to upload files because the element following the one affected by the omission of closing tags was the "Upload files" option

Thanks for the help, greetings

answered by 26.01.2017 в 09:48