I need to write a file input that accepts CSV file, validates it and if there is error in file will not be uploaded. Here's code of React Component:
<CustomInput
type="file"
id="fileBrowser"
name="file"
label={filename || 'Choose CSV'}
onChange={this.loadFile}
accept="text/csv"
invalid={!file.isValid}
/>
So I have problem: onChange event handles only when input file is changed. Imagine that I input invalid CSV file, get error, find it in this file, correct and try load this file again but onChange event doesn't handle because input thinks I have the same file because of its name. The only resolution I've found is to load another file and again old file or change name of old file.
If there's another solution?