diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-12-14 15:35:08 -0500 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-12-14 15:35:08 -0500 |
commit | 6e08669d22cce01a4b1e54c64bc236899c959163 (patch) | |
tree | e49eb02f6c03d48aea2e6eab872a0882c2706565 /web | |
parent | f5ec973cba4c224de5ba75b56aad447f715b9d6b (diff) | |
download | chat-6e08669d22cce01a4b1e54c64bc236899c959163.tar.gz chat-6e08669d22cce01a4b1e54c64bc236899c959163.tar.bz2 chat-6e08669d22cce01a4b1e54c64bc236899c959163.zip |
Added clientside check for profile image size
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/user_settings/user_settings_general.jsx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/web/react/components/user_settings/user_settings_general.jsx b/web/react/components/user_settings/user_settings_general.jsx index 7c1a1297f..c47f7d33d 100644 --- a/web/react/components/user_settings/user_settings_general.jsx +++ b/web/react/components/user_settings/user_settings_general.jsx @@ -9,6 +9,7 @@ import UserStore from '../../stores/user_store.jsx'; import ErrorStore from '../../stores/error_store.jsx'; import * as Client from '../../utils/client.jsx'; +import Constants from '../../utils/constants.jsx'; import * as AsyncClient from '../../utils/async_client.jsx'; import * as Utils from '../../utils/utils.jsx'; @@ -156,8 +157,12 @@ export default class UserSettingsGeneralTab extends React.Component { if (picture.type !== 'image/jpeg' && picture.type !== 'image/png') { this.setState({clientError: 'Only JPG or PNG images may be used for profile pictures.'}); return; + } else if (picture.size > Constants.MAX_FILE_SIZE) { + this.setState({clientError: 'Unable to upload profile image. File is too large.'}); + return; } + var formData = new FormData(); formData.append('image', picture, picture.name); this.setState({loadingPicture: true}); |