I am taking input from the user as a file using the below code:
render() {
const handleFileChange: React.ChangeEventHandler<HTMLInputElement> = (e) => {
e.persist();
Array.from(e.currentTarget.files || []).forEach(file => {
let modelname = file.name
consle.log(modelname)
});
};
return (
<>
<input accept=".csar,.yaml" type="file" name="filenameanddata" onChange={(e) => {
handleFileChange(e)}} />
<label htmlFor="file">
<Button className = {inputUploadButton} variant="primary" type="submit" onClick={e => e.stopPropagation()}>Upload
</Button>
</label>
</>
)
}
After taking input files display on UI and I am also given the option to delete them.
But after deleting I want to take the same file name from the user. In that input is not working properly.
How to do that any idea? or Is there any way to forcefully call onChange event if an event is not changed?