HOR-4039 Logo> Validation in uploading files, does not work with executable extensions.

- Add validation in js
This commit is contained in:
Marco Antonio Nina Mena
2017-11-20 10:12:47 -04:00
parent c7b6c4128c
commit f841814a7d

View File

@@ -243,13 +243,31 @@ Ext.onReady(function() {
emptyText : '',
fieldLabel : _('ID_IMAGE'),
buttonText : _('ID_SELECT_FILE'),
name : 'img'
name : 'img',
validator: function (filePath) {
var flag, btn;
btn = Ext.getCmp('btnUpload');
btn.disable();
filePath = filePath.replace(/^\s|\s$/g, ""); //trims string
if (filePath.match(/([^\/\\]+)\.(gif|png|jpg|jpeg|pjpeg|x-png)$/i)) {
flag = true;
btn.enable();
} else {
messageError = _('ID_ERROR_UPLOADING_IMAGE_TYPE');
PMExt.notify(_('ID_SUCCESS'), messageError);
flag = false;
}
return flag;
}
}
],
buttons :
[
{
text : _('ID_UPLOAD'),
id : 'btnUpload',
disabled: true,
handler : function() {
panelRightTop.getForm().submit({
url : '../adminProxy/uploadImage',