protected function getUploader()
    {
        if (is_null($this->fileUploader)) {
            $this->fileUploader = $this->uploaderFactory->create();

            $this->fileUploader->init();

            $dirConfig = DirectoryList::getDefaultConfig();
            $dirAddon = $dirConfig[DirectoryList::MEDIA][DirectoryList::PATH];
            $DS = DIRECTORY_SEPARATOR;
            $tmpPath = $dirAddon . $DS . $this->mediaDirectory->getRelativePath('import');

            if (!$this->fileUploader->setTmpDir($tmpPath)) {
                throw new LocalizedException(
                    __('File directory \'%1\' is not readable.', $tmpPath)
                );
            }

            $destinationDir = "catalog/category";
            $destinationPath = $dirAddon . $DS . $this->mediaDirectory->getRelativePath($destinationDir);
            $this->mediaDirectory->create($destinationPath);

            if (!$this->fileUploader->setDestDir($destinationPath)) {
                throw new LocalizedException(
                    __('File directory \'%1\' is not writable.', $destinationPath)
                );
            }
        }

        return $this->fileUploader;
    }
protected function getUploader()
    {
        if (is_null($this->fileUploader)) {
            $this->fileUploader = $this->uploaderFactory->create();

            $this->fileUploader->init();

            $dirConfig = DirectoryList::getDefaultConfig();
            $dirAddon = $dirConfig[DirectoryList::MEDIA][DirectoryList::PATH];
            $DS = DIRECTORY_SEPARATOR;
            $tmpPath = $dirAddon . $DS . $this->mediaDirectory->getRelativePath('import');

            if (!$this->fileUploader->setTmpDir($tmpPath)) {
                throw new LocalizedException(
                    __('File directory \'%1\' is not readable.', $tmpPath)
                );
            }

            $destinationDir = "catalog/category";
            $destinationPath = $dirAddon . $DS . $this->mediaDirectory->getRelativePath($destinationDir);
            $this->mediaDirectory->create($destinationPath);

            if (!$this->fileUploader->setDestDir($destinationPath)) {
                throw new LocalizedException(
                    __('File directory \'%1\' is not writable.', $destinationPath)
                );
            }
        }

        return $this->fileUploader;
    }
protected function getUploader ( ) { if ( is_null ( $ this -> fileUploader ) ) { $ this -> fileUploader = $ this -> uploaderFactory -> create ( ) ; $ this -> fileUploader -> init ( ) ; $ dirConfig = DirectoryList :: getDefaultConfig ( ) ; $ dirAddon = $ dirConfig [ DirectoryList :: MEDIA ] [ DirectoryList :: PATH ] ; $ DS = DIRECTORY_SEPARATOR ; $ tmpPath = $ dirAddon . $ DS . $ this -> mediaDirectory -> getRelativePath ( 'import' ) ; if ( ! $ this -> fileUploader -> setTmpDir ( $ tmpPath ) ) { throw new LocalizedException ( __ ( 'File directory \'%1\' is not readable.' , $ tmpPath ) ) ; } $ destinationDir = "catalog/category" ; $ destinationPath = $ dirAddon . $ DS . $ this -> mediaDirectory -> getRelativePath ( $ destinationDir ) ; $ this -> mediaDirectory -> create ( $ destinationPath ) ; if ( ! $ this -> fileUploader -> setDestDir ( $ destinationPath ) ) { throw new LocalizedException ( __ ( 'File directory \'%1\' is not writable.' , $ destinationPath ) ) ; } } return $ this -> fileUploader ; }
Returns an object for upload a media files

@throws LocalizedException
@return \Magento\CatalogImportExport\Model\Import\Uploader
Returns an object for upload a media files