Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input ref={el => { this.refInput = el }} accept="image/*"
- className="viewInputGallery" type="file" onChange={this.onChoosePhoto} />
- onChoosePhoto = event => {
- if (event.target.files && event.target.files[0]) {
- this.setState({ isLoading: true })
- this.currentPhotoFile = event.target.files[0]
- // Check this file is an image?
- const prefixFiletype = event.target.files[0].type.toString()
- if (prefixFiletype.indexOf(AppString.PREFIX_IMAGE) === 0) {
- this.uploadPhoto()
- } else {
- this.setState({ isLoading: false })
- this.props.showToast(0, 'This file is not an image')
- }
- } else {
- this.setState({ isLoading: false })
- }
- }
Add Comment
Please, Sign In to add comment