Skip to content

Commit edf83a4

Browse files
authored
ENGCOM-3973: [Backport] Fix issue with file uploading if an upload field is disabled #20636
2 parents fd04ab2 + bd6230c commit edf83a4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

app/code/Magento/Ui/i18n/en_US.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,4 @@ CSV,CSV
202202
"Please enter at least {0} characters.","Please enter at least {0} characters."
203203
"Please enter a value between {0} and {1} characters long.","Please enter a value between {0} and {1} characters long."
204204
"Please enter a value between {0} and {1}.","Please enter a value between {0} and {1}."
205+
"The file upload field is disabled.","The file upload field is disabled."

app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ define([
1313
'Magento_Ui/js/modal/alert',
1414
'Magento_Ui/js/lib/validation/validator',
1515
'Magento_Ui/js/form/element/abstract',
16+
'mage/translate',
1617
'jquery/file-uploader'
17-
], function ($, _, utils, uiAlert, validator, Element) {
18+
], function ($, _, utils, uiAlert, validator, Element, $t) {
1819
'use strict';
1920

2021
return Element.extend({
@@ -328,6 +329,12 @@ define([
328329
allowed = this.isFileAllowed(file),
329330
target = $(e.target);
330331

332+
if (this.disabled()) {
333+
this.notifyError($t('The file upload field is disabled.'));
334+
335+
return;
336+
}
337+
331338
if (allowed.passed) {
332339
target.on('fileuploadsend', function (event, postData) {
333340
postData.data.append('param_name', this.paramName);

0 commit comments

Comments
 (0)