Class Socialveo\Core\library\FileUploader

InheritanceSocialveo\Core\library\FileUploader » Phalcon\Mvc\User\Component
Uses TraitsSocialveo\Core\Translatable

Class FileUploader

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor Socialveo\Core\library\FileUploader
_t() Gets translations Socialveo\Core\Translatable
combineChunks() Combine the uploaded chunks to one file Socialveo\Core\library\FileUploader
extensionByContentType() Get file extension by content type Socialveo\Core\library\FileUploader
processMediaFile() Process media file Socialveo\Core\library\FileUploader
processUploadedFile() Saves the uploaded file, creates additional files and resize them if file is a image Socialveo\Core\library\FileUploader
sanitizeFilename() Sanitizes a string filename Socialveo\Core\library\FileUploader
t() Gets translations Socialveo\Core\Translatable
toBytes() Converts size with units to bytes, like in php.ini 128M -> (128 1024 1024) bytes -> 134217728 bytes Socialveo\Core\library\FileUploader
uploadFile() Uploading the file Socialveo\Core\library\FileUploader

Property Details

$allowedFileExtensions protected property (available since version 1.0)

Allowed file extensions

protected array $allowedFileExtensions = ['csv''pdf''doc''docx''xls''xlsx''zip''rar']
$allowedImageExtensions protected property (available since version 1.0)

Allowed images extensions

protected array $allowedImageExtensions = ['jpg''jpeg''gif''png''bmp']
$allowedMediaExtensions protected property (available since version 1.0)

Allowed media extensions

$allowedVideoExtensions protected property (available since version 1.0)

Allowed video extensions

protected array $allowedVideoExtensions = ['avi''mpeg''mpg''mp4''mov''wmv''flv''ogg''ogv''webm''3gp']
$chunksExpireIn protected property (available since version 1.0)
protected integer $chunksExpireIn 604800
$chunksFolder protected property (available since version 1.0)
protected string $chunksFolder 'chunks'
$iniMaxFileSize protected property (available since version 1.0)
protected integer $iniMaxFileSize null
$maxFileSize protected property (available since version 1.0)
protected integer $maxFileSize '128M'
$uploadDir protected property (available since version 1.0)
protected string $uploadDir null

Method Details

__construct() public method

Constructor

public void __construct ( )
combineChunks() public method (available since version 1.0)

Combine the uploaded chunks to one file

public array combineChunks ( $network_uuid, $options = [] )
$network_uuid string
$options array

[optional]

return array

$result

extensionByContentType() public method

Get file extension by content type

public mixed extensionByContentType ( $contentType )
$contentType
throws Exception
processMediaFile() public method

Process media file

public array processMediaFile ( $filename, $network_uuid, $options = [] )
$filename string
$network_uuid
$options array

[optional]

throws Exception
processUploadedFile() public method (available since version 1.0)

Saves the uploaded file, creates additional files and resize them if file is a image

public array processUploadedFile ( $fileinfo, $network_uuid, $options = [] )
$fileinfo array
$network_uuid string
$options array

[optional]

return array

$result

sanitizeFilename() public method (available since version 1.0)

Sanitizes a string filename

public string sanitizeFilename ( $filename )
$filename string

To be sanitized

return string

Sanitized

toBytes() public static method (available since version 1.0)

Converts size with units to bytes, like in php.ini 128M -> (128 1024 1024) bytes -> 134217728 bytes

public static integer toBytes ( $str )
$str string
uploadFile() public method (available since version 1.0)

Uploading the file

public array uploadFile ( $file, $network_uuid, $options = [] )
$file Phalcon\Http\Request\File|mixed
$network_uuid string
$options array

[optional]

return array

$result

throws Exception