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 .
Code:
function validateForm() {
var file = document.getElementById("file_to_upload");
console.log(file);
console.log(file.files);
if (file.files.length == 0) {
window.alert("Debe seleccionar un archivo para subir");
return false;
}
}
function upload_alternative() {
var upload = document.getElementById("upload");
upload.click();
}
<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" />
</form>