I am trying to get the filepath of the selected file.
Using the debugger, I see that the file has an property called value which is equal to : "C:\fakepath\filename.txt".
However when I try to access file.value, the filepath is equal to null.
I am using Java 8, Struts 1.2, Jsps, and Chrome
Javascript:
function validateFile(file)
{
filepath = file.value; /*This is null*/
return true;
}
Html:
<input type="file" id="theFile[0]" onChange="validateFile(this)"/>
validateFile(this)and instead offunction validateFile(fileid)usefunction validateFile(file). Remove the variable declaration forvar filealso.filepath = file.valuewhenvar file = ...was set isn't an attempt to set the value property withfilepath?Cannot set property 'value'means something basically didundefined.value = ...there is no code in the example that does that