Guest User

Untitled

a guest
Feb 15th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. validateImageWeight = imageFile => {
  2. if (imageFile && imageFile.size) {
  3. // Get image size in kilobytes
  4. const imageFileKb = imageFile.size / 1024;
  5. const { maxWeight } = this.props;
  6. if (imageFileKb > maxWeight) {
  7. return `Image size must be less or equal to ${maxWeight}kb`;
  8. }
  9. }
  10. };
Add Comment
Please, Sign In to add comment