From 6e08669d22cce01a4b1e54c64bc236899c959163 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Mon, 14 Dec 2015 15:35:08 -0500 Subject: Added clientside check for profile image size --- web/react/components/user_settings/user_settings_general.jsx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'web/react/components/user_settings') 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}); -- cgit v1.2.3-1-g7c22 From 76e1f1f6138de9cfea03847af0eff61a10261043 Mon Sep 17 00:00:00 2001 From: hmhealey Date: Mon, 14 Dec 2015 16:04:10 -0500 Subject: Added serverside file size check for post attachments --- web/react/components/user_settings/user_settings_general.jsx | 1 - 1 file changed, 1 deletion(-) (limited to 'web/react/components/user_settings') diff --git a/web/react/components/user_settings/user_settings_general.jsx b/web/react/components/user_settings/user_settings_general.jsx index c47f7d33d..014038dd4 100644 --- a/web/react/components/user_settings/user_settings_general.jsx +++ b/web/react/components/user_settings/user_settings_general.jsx @@ -162,7 +162,6 @@ export default class UserSettingsGeneralTab extends React.Component { return; } - var formData = new FormData(); formData.append('image', picture, picture.name); this.setState({loadingPicture: true}); -- cgit v1.2.3-1-g7c22