Definition at line 14 of file Service.php.
◆ __construct()
Constructor
- Parameters
-
\Magento\Framework\Filesystem | $filesystem | |
\Magento\Framework\File\Size | $fileSize | |
\Magento\Framework\Convert\DataSize | $dataSize | |
\Magento\MediaStorage\Model\File\UploaderFactory | $uploaderFactory | |
array | $uploadLimits | keys are 'css' and 'js' for file type, values defines maximum file size, example: 2M |
Definition at line 73 of file Service.php.
81 $this->_fileSize = $fileSize;
82 $this->_uploaderFactory = $uploaderFactory;
84 if (isset($uploadLimits[
'css'])) {
85 $this->_cssUploadLimit = $uploadLimits[
'css'];
87 if (isset($uploadLimits[
'js'])) {
88 $this->_jsUploadLimit = $uploadLimits[
'js'];
◆ _validateFileSize()
_validateFileSize |
( |
|
$fileSize, |
|
|
|
$maxFileSize |
|
) |
| |
|
protected |
Validate max file size
- Parameters
-
int | $fileSize | |
int | $maxFileSize | |
- Returns
- bool
Definition at line 218 of file Service.php.
220 if ($fileSize > $maxFileSize) {
◆ getCssUploadMaxSize()
Get css upload max size
- Returns
- int
Definition at line 160 of file Service.php.
162 return $this->_getMaxUploadSize($this->_cssUploadLimit);
◆ getCssUploadMaxSizeInMb()
getCssUploadMaxSizeInMb |
( |
| ) |
|
Get css upload max size in megabytes
- Returns
- float
Definition at line 196 of file Service.php.
◆ getFileContent()
getFileContent |
( |
|
$filePath | ) |
|
Get uploaded file content
- Parameters
-
- Returns
- string
Definition at line 150 of file Service.php.
152 return $this->_tmpDirectory->readFile($this->_tmpDirectory->getRelativePath($filePath));
◆ getJsUploadMaxSize()
Get js upload max size
- Returns
- int
Definition at line 170 of file Service.php.
172 return $this->_getMaxUploadSize($this->_jsUploadLimit);
◆ getJsUploadMaxSizeInMb()
getJsUploadMaxSizeInMb |
( |
| ) |
|
Get js upload max size in megabytes
- Returns
- float
Definition at line 206 of file Service.php.
◆ $_cssUploadLimit
◆ $_filePath
◆ $_fileSize
◆ $_jsUploadLimit
◆ $_tmpDirectory
◆ $_uploader
◆ $_uploaderFactory
◆ $dataSize
The documentation for this class was generated from the following file: