Created
August 3, 2018 12:05
-
-
Save bjankord/e2c2435c0665fe2b23ecef10ffd15c08 to your computer and use it in GitHub Desktop.
Controlled File Input
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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