Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Controlled File Input
class ControlledFileInput extends React.Component {
constructor(props) {
super(props);
this.handleChange = this.handleChange.bind(this);
}
handleChange(event) {
console.log('Selected file:', event.target.files[0]);
}
render() {
return (
<Input
name="FileUpload"
onChange={this.handleChange}
type="file"
/>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.