Added serverside file size check for post attachments

Этот коммит содержится в:
hmhealey
2015-12-14 16:04:10 -05:00
родитель 6e08669d22
Коммит 76e1f1f613
2 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@@ -76,6 +76,12 @@ func uploadFile(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if r.ContentLength > model.MAX_FILE_SIZE {
c.Err = model.NewAppError("uploadFile", "Unable to upload file. File is too large.", "")
c.Err.StatusCode = http.StatusRequestEntityTooLarge
return
}
err := r.ParseMultipartForm(model.MAX_FILE_SIZE)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)

Просмотреть файл

@@ -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});