Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- validateImageWeight = imageFile => {
- if (imageFile && imageFile.size) {
- // Get image size in kilobytes
- const imageFileKb = imageFile.size / 1024;
- const { maxWeight } = this.props;
- if (imageFileKb > maxWeight) {
- return `Image size must be less or equal to ${maxWeight}kb`;
- }
- }
- };
Add Comment
Please, Sign In to add comment