I'm trying to implement a solution where you hide the file chosen by a user for an input type of 'file'. Here is the stack article that outlines the solution: input type=file show only button
I am not able to capture the onChange event, and hence am unable to read the file. The event in the method 'saveFileToStoreOnChange' is undefined. Where did I go off the road here?
html (jsx):
<input className="invisible" type="file" id="logo"/>
<input type="button" value="Browse..." onClick={this.saveFileToStoreClick} />
Javascript:
saveFileToStoreClick(){
$('#logo').on('change', this.saveFileToStoreOnChange());
}
saveFileToStoreOnChange(event){
//event is undefined
let file = event.target.files[0];
}