Skip to content

Commit e6e6769

Browse files
committed
upload media files fix
1 parent bec9025 commit e6e6769

File tree

1 file changed

+7
-5
lines changed
  • app/code/Magento/CatalogImportExport/Model/Import

1 file changed

+7
-5
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ protected function _initTypeModels()
11981198
// phpcs:disable Magento2.Performance.ForeachArrayMerge.ForeachArrayMerge
11991199
$this->_fieldsMap = array_merge($this->_fieldsMap, $model->getCustomFieldsMapping());
12001200
$this->_specialAttributes = array_merge($this->_specialAttributes, $model->getParticularAttributes());
1201-
// phpcs:enable
1201+
// phpcs:enable
12021202
}
12031203
$this->_initErrorTemplates();
12041204
// remove doubles
@@ -2035,9 +2035,9 @@ protected function _saveProductTierPrices(array $tierPriceData)
20352035
protected function _getUploader()
20362036
{
20372037
if ($this->_fileUploader === null) {
2038-
$this->_fileUploader = $this->_uploaderFactory->create();
2038+
$fileUploader = $this->_uploaderFactory->create();
20392039

2040-
$this->_fileUploader->init();
2040+
$fileUploader->init();
20412041

20422042
$dirConfig = DirectoryList::getDefaultConfig();
20432043
$dirAddon = $dirConfig[DirectoryList::MEDIA][DirectoryList::PATH];
@@ -2048,7 +2048,7 @@ protected function _getUploader()
20482048
$tmpPath = $dirAddon . '/' . $this->_mediaDirectory->getRelativePath('import');
20492049
}
20502050

2051-
if (!$this->_fileUploader->setTmpDir($tmpPath)) {
2051+
if (!$fileUploader->setTmpDir($tmpPath)) {
20522052
throw new LocalizedException(
20532053
__('File directory \'%1\' is not readable.', $tmpPath)
20542054
);
@@ -2057,11 +2057,13 @@ protected function _getUploader()
20572057
$destinationPath = $dirAddon . '/' . $this->_mediaDirectory->getRelativePath($destinationDir);
20582058

20592059
$this->_mediaDirectory->create($destinationPath);
2060-
if (!$this->_fileUploader->setDestDir($destinationPath)) {
2060+
if (!$fileUploader->setDestDir($destinationPath)) {
20612061
throw new LocalizedException(
20622062
__('File directory \'%1\' is not writable.', $destinationPath)
20632063
);
20642064
}
2065+
2066+
$this->_fileUploader = $fileUploader;
20652067
}
20662068
return $this->_fileUploader;
20672069
}

0 commit comments

Comments
 (0)