i have a regular html form like this:
<form action="MultipartServlet" name="form" id="form" method="post" enctype="multipart/form-data">
<td><input type="file" name="upload" id="upload" />
<td><input type="button" value="Check" onclick="FileValidator.check()"/>
i cannot use type="submit" because for an odd reason the application is crushing
the JS code:
check: function() {
var file = $F("upload");
new Ajax.Request( 'url', {
parameters: '...&action=fileValidator&upload=' + file,
onSuccess: function(response) {
var result = eval('(' + response.responseText + ')');
if (result.success) {
displayErrorsFromFile();
} else {
alert("Errors! " + response.responseText);
}
},
onFailure: reportError
})
}
in the Java code i just try to get the file trough the "upload" parameter and validate the file's imput.
so i guess that the "upload" parameter has to get a bites array of the entire file so it can process it... or somehow the path of the file