Created
May 2, 2019 07:25
-
-
Save sktwentysix/8226cbc2a258912d1479a4120e5a0cac to your computer and use it in GitHub Desktop.
medium-ocr-react-handlechange
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
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