FileUploadService
extends StorageBaseService
in package
A simple helper to handle file uploads
Tags
Table of Contents
- BASE_PATH = __ROOT__
- PUBLIC_PATH = self::BASE_PATH . '/public/'
- SAVE_PATH = self::BASE_PATH . '/public/' . self::WEB_PATH
- WEB_PATH = '/jinya-content/'
- $conversionService : ConversionService
- $logger : LoggerInterface
- __construct() : mixed
- clearChunks() : void
- Removes all chunks for the given file
- finishUpload() : null|object
- Finishes the upload for the given file
- saveChunk() : UploadingFileChunk
- Saves a new file chunk and returns it
- getFileHash() : string
- Hashes the given resources content
Constants
BASE_PATH
public
string
BASE_PATH
= __ROOT__
The base path of Jinya CMS
Tags
PUBLIC_PATH
public
mixed
PUBLIC_PATH
= self::BASE_PATH . '/public/'
Tags
SAVE_PATH
public
string
SAVE_PATH
= self::BASE_PATH . '/public/' . self::WEB_PATH
The full base path for stored files
Tags
WEB_PATH
public
string
WEB_PATH
= '/jinya-content/'
The base path for web data
Tags
Properties
$conversionService read-only
private
ConversionService
$conversionService
= new ConversionService()
Tags
$logger read-only
private
LoggerInterface
$logger
Tags
Methods
__construct()
public
__construct([ConversionService $conversionService = new ConversionService() ]) : mixed
Parameters
- $conversionService : ConversionService = new ConversionService()
Tags
Return values
mixed —clearChunks()
Removes all chunks for the given file
public
clearChunks(int $fileId) : void
Parameters
- $fileId : int
Tags
Return values
void —finishUpload()
Finishes the upload for the given file
public
finishUpload(int $fileId) : null|object
Parameters
- $fileId : int
Tags
Return values
null|object —saveChunk()
Saves a new file chunk and returns it
public
saveChunk(int $fileId, int $position, string|resource|null $data) : UploadingFileChunk
Parameters
- $fileId : int
- $position : int
- $data : string|resource|null
Tags
Return values
UploadingFileChunk —getFileHash()
Hashes the given resources content
protected
getFileHash(resource $fileContent) : string
Parameters
- $fileContent : resource