I have an input type file in a form that I would like to be immediately read as a text file and used to update the value of a text input:
HTML:
<input type=file id='uploadfile' name='uploadfile' onchange="uploadCoordinates(this.form)">
JS:
function uploadCoordinates(form) {
var file=form.uploadfile.value;
var reader=new FileReader();
reader.readAsText(file.value);
form.coordinates.value=reader.result;
}
Howveer, I get the following error: uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMFileReader.readAsText]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: https://portal.nersc.gov/project/als/ShirleyXAS/ShirleyXAS.js :: uploadCoordinates :: line 142" data: no]