Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
Uploader Class Reference
Inheritance diagram for Uploader:
Uploader

Public Member Functions

 __construct ()
 
 processFileAttributes ($fileAttributes)
 
- Public Member Functions inherited from Uploader
 __construct ( $fileId, Mime $fileMime=null)
 
 save ($destinationFolder, $newFileName=null)
 
 getFileExtension ()
 
 addValidateCallback ($callbackName, $callbackObject, $callbackMethod)
 
 removeValidateCallback ($callbackName)
 
 correctFileNameCase ($fileName)
 
 checkMimeType ($validTypes=[])
 
 getUploadedFileName ()
 
 setAllowCreateFolders ($flag)
 
 setAllowRenameFiles ($flag)
 
 setFilesDispersion ($flag)
 
 setFilenamesCaseSensitivity ($flag)
 
 setAllowedExtensions ($extensions=[])
 
 checkAllowedExtension ($extension)
 

Additional Inherited Members

- Static Public Member Functions inherited from Uploader
static getCorrectFileName ($fileName)
 
static getNewFileName ($destinationFile)
 
static getDispretionPath ($fileName)
 
static getDispersionPath ($fileName)
 
- Data Fields inherited from Uploader
const SINGLE_STYLE = 0
 
const MULTIPLE_STYLE = 1
 
const TMP_NAME_EMPTY = 666
 
const MAX_IMAGE_WIDTH = 4096
 
const MAX_IMAGE_HEIGHT = 2160
 
- Protected Member Functions inherited from Uploader
 _afterSave ($result)
 
 chmod ($file)
 
 _moveFile ($tmpPath, $destPath)
 
 _validateFile ()
 
- Static Protected Member Functions inherited from Uploader
static _addDirSeparator ($dir)
 
- Protected Attributes inherited from Uploader
 $_file
 
 $_fileMimeType
 
 $_uploadType
 
 $_uploadedFileName
 
 $_uploadedFileDir
 
 $_allowCreateFolders = true
 
 $_allowRenameFiles = false
 
 $_enableFilesDispersion = false
 
 $_caseInsensitiveFilenames = true
 
 $_dispretionPath = null
 
 $_fileExists = false
 
 $_allowedExtensions = null
 
 $_validateCallbacks = []
 
 $_result
 

Detailed Description

Class Uploader specific to uploading images using services

Definition at line 12 of file Uploader.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Avoid running the default constructor specific to FILE upload

Definition at line 17 of file Uploader.php.

18  {
19  }

Member Function Documentation

◆ processFileAttributes()

processFileAttributes (   $fileAttributes)

Explicitly set the file attributes instead of setting it via constructor

Parameters
array$fileAttributes
Returns
void
Exceptions

Definition at line 28 of file Uploader.php.

29  {
30  $this->_file = $fileAttributes;
31  if (!file_exists($this->_file['tmp_name'])) {
32  $code = empty($this->_file['tmp_name']) ? self::TMP_NAME_EMPTY : 0;
33  throw new \Exception('File was not processed correctly.', $code);
34  } else {
35  $this->_fileExists = true;
36  }
37  }
$code
Definition: info.phtml:12

The documentation for this class was generated from the following file: