Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. updateImage = (file) => {
  2.  
  3. let not_a_valid_image = '';
  4.  
  5. var valid = /(\.jpg|\.jpeg|\.png|\.pdf)$/i;
  6.  
  7. if(!valid.exec(file.name)){
  8. not_a_valid_image = 'Please upload a valid image';
  9. this.props.onError && this.props.onError(not_a_valid_image);
  10. } else {
  11. this.setState({err: '',image: file})
  12. this.props.getImage(file)
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement