Class humhub\modules\file\components\StorageManager

Inheritancehumhub\modules\file\components\StorageManager » yii\base\Component
Implementshumhub\modules\file\components\StorageManagerInterface
Available since version1.2

StorageManager for File records

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$fileMode integer File mode humhub\modules\file\components\StorageManager
$originalFileName string File name of the base file (without variant) humhub\modules\file\components\StorageManager

Public Methods

Hide inherited methods

MethodDescriptionDefined By
delete() Deletes a stored file (-variant) humhub\modules\file\components\StorageManager
get() Returns the complete file path to the stored file (variant). humhub\modules\file\components\StorageManager
getVariants() Get file variants humhub\modules\file\components\StorageManager
set() Adds or overwrites the file by given UploadedFile in store humhub\modules\file\components\StorageManager
setContent() Adds or overwrites the file content by given string in store humhub\modules\file\components\StorageManager
setFile() Sets the file for this storage manager instance humhub\modules\file\components\StorageManager

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getPath() Returns the path where the files of this file are located humhub\modules\file\components\StorageManager

Property Details

$file protected property
$fileMode public property

File mode

public integer $fileMode 484
$originalFileName public property

File name of the base file (without variant)

public string $originalFileName 'file'
$storagePath protected property

Storage base path

protected string $storagePath '@webroot/uploads/file'

Method Details

delete() public method

Deletes a stored file (-variant)

If not variant is given, also all file variants will be deleted

public void delete ( $variant null )
$variant
get() public method

Returns the complete file path to the stored file (variant).

public string get ( $variant null )
$variant string

Optional the variant string

return string

The complete file path

getPath() protected method

Returns the path where the files of this file are located

protected string getPath ( )
return string

The path

getVariants() public method

Get file variants

public array getVariants ( )
return array

Returns the stored variants of the file

set() public method

Adds or overwrites the file by given UploadedFile in store

public void set ( \yii\web\UploadedFile $file, $variant null )
$file \yii\web\UploadedFile
$variant string

The variant identifier

setContent() public method

Adds or overwrites the file content by given string in store

public void setContent ( $content, $variant null )
$content string

The new file data

$variant string

The variant identifier

setFile() public method

Sets the file for this storage manager instance

public void setFile ( humhub\modules\file\models\File $file )
$file humhub\modules\file\models\File