Skip to content

Commit bd04039

Browse files
author
Serhii Balko
committed
Merge remote-tracking branch 'origin/MC-42203' into 2.4-develop-pr61
2 parents 69a288d + 907f99f commit bd04039

File tree

1 file changed

+11
-3
lines changed
  • app/code/Magento/Customer/Controller/Adminhtml/File/Customer

1 file changed

+11
-3
lines changed

app/code/Magento/Customer/Controller/Adminhtml/File/Customer/Upload.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Magento\Framework\Exception\LocalizedException;
1515
use Psr\Log\LoggerInterface;
1616

17+
/**
18+
* Class for upload customer file attribute
19+
*/
1720
class 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();

0 commit comments

Comments
 (0)