Skip to content

Instantly share code, notes, and snippets.

@sktwentysix
Created May 2, 2019 07:25
Show Gist options
  • Save sktwentysix/8226cbc2a258912d1479a4120e5a0cac to your computer and use it in GitHub Desktop.
Save sktwentysix/8226cbc2a258912d1479a4120e5a0cac to your computer and use it in GitHub Desktop.
medium-ocr-react-handlechange
handleChange = (event) => {
if (event.target.files[0]) {
var uploads = []
for (var key in event.target.files) {
if (!event.target.files.hasOwnProperty(key)) continue;
let upload = event.target.files[key]
uploads.push(URL.createObjectURL(upload))
}
this.setState({
uploads: uploads
})
} else {
this.setState({
uploads: []
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment