Created
June 18, 2019 23:06
-
-
Save elchele/b87b7f422933ede747e235481ab7f074 to your computer and use it in GitHub Desktop.
Debugging file upload issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
/* File: ./custom/clients/base/fields/file/file.js */ | |
extendsFrom: 'FileField', | |
_doValidateFileError: function(fields, errors, callback, resp) { | |
app.alert.dismiss('upload'); | |
app.logger.fatal(resp); | |
var errors = errors || {}, | |
fieldName = this.name; | |
errors[fieldName] = {}; | |
switch (resp.error) { | |
case 'request_too_large': | |
errors[fieldName].tooBig = true; | |
break; | |
default: | |
errors[fieldName].uploadFailed = true; | |
} | |
this.model.unset(fieldName + '_guid'); | |
callback(null, fields, errors); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment