File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
app/code/Magento/Customer/Controller/Adminhtml/File/Customer Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 14
14
use Magento \Framework \Exception \LocalizedException ;
15
15
use Psr \Log \LoggerInterface ;
16
16
17
+ /**
18
+ * Class for upload customer file attribute
19
+ */
17
20
class Upload extends Action
18
21
{
19
22
/**
@@ -38,6 +41,11 @@ class Upload extends Action
38
41
*/
39
42
private $ logger ;
40
43
44
+ /**
45
+ * @var string
46
+ */
47
+ private $ scope ;
48
+
41
49
/**
42
50
* @param Context $context
43
51
* @param FileUploaderFactory $fileUploaderFactory
@@ -65,15 +73,15 @@ public function execute()
65
73
if (empty ($ _FILES )) {
66
74
throw new \Exception ('$_FILES array is empty. ' );
67
75
}
68
-
69
- $ attributeCode = key ($ _FILES [' customer ' ]['name ' ]);
76
+ $ scope = array_key_first ( $ _FILES );
77
+ $ attributeCode = key ($ _FILES [$ scope ]['name ' ]);
70
78
$ attributeMetadata = $ this ->customerMetadataService ->getAttributeMetadata ($ attributeCode );
71
79
72
80
/** @var FileUploader $fileUploader */
73
81
$ fileUploader = $ this ->fileUploaderFactory ->create ([
74
82
'attributeMetadata ' => $ attributeMetadata ,
75
83
'entityTypeCode ' => CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER ,
76
- 'scope ' => ' customer ' ,
84
+ 'scope ' => $ scope ,
77
85
]);
78
86
79
87
$ errors = $ fileUploader ->validate ();
You can’t perform that action at this time.
0 commit comments