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 1414use Magento \Framework \Exception \LocalizedException ;
1515use Psr \Log \LoggerInterface ;
1616
17+ /**
18+ * Class for upload customer file attribute
19+ */
1720class Upload extends Action
1821{
1922 /**
@@ -38,6 +41,11 @@ class Upload extends Action
3841 */
3942 private $ logger ;
4043
44+ /**
45+ * @var string
46+ */
47+ private $ scope ;
48+
4149 /**
4250 * @param Context $context
4351 * @param FileUploaderFactory $fileUploaderFactory
@@ -65,15 +73,15 @@ public function execute()
6573 if (empty ($ _FILES )) {
6674 throw new \Exception ('$_FILES array is empty. ' );
6775 }
68-
69- $ attributeCode = key ($ _FILES [' customer ' ]['name ' ]);
76+ $ scope = array_key_first ( $ _FILES );
77+ $ attributeCode = key ($ _FILES [$ scope ]['name ' ]);
7078 $ attributeMetadata = $ this ->customerMetadataService ->getAttributeMetadata ($ attributeCode );
7179
7280 /** @var FileUploader $fileUploader */
7381 $ fileUploader = $ this ->fileUploaderFactory ->create ([
7482 'attributeMetadata ' => $ attributeMetadata ,
7583 'entityTypeCode ' => CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER ,
76- 'scope ' => ' customer ' ,
84+ 'scope ' => $ scope ,
7785 ]);
7886
7987 $ errors = $ fileUploader ->validate ();
You can’t perform that action at this time.
0 commit comments