Skip to content

Instantly share code, notes, and snippets.

@bjankord
Created August 3, 2018 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjankord/e2c2435c0665fe2b23ecef10ffd15c08 to your computer and use it in GitHub Desktop.
Save bjankord/e2c2435c0665fe2b23ecef10ffd15c08 to your computer and use it in GitHub Desktop.
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