File
in package
Table of Contents
- APPEND_BINARY = 'ab'
- CHUNK_SIZE = 8192
- INPUT_STREAM = 'php://input'
- READ_BINARY = 'rb'
- $cache : Cacheable
- $checksum : string
- $filePath : string
- $fileSize : int
- $key : string
- $location : string
- $name : string
- $offset : int
- $uploadMetadata : array<string|int, string>
- __construct() : mixed
- File constructor.
- close() : bool
- Close file.
- copy() : bool
- Copy file from source to destination.
- delete() : bool
- Delete file and/or folder.
- deleteFiles() : bool
- Delete multiple files.
- details() : array<string|int, mixed>
- Get file meta.
- exists() : bool
- Check if file to read exists.
- getChecksum() : string
- Get checksum.
- getFilePath() : string
- Get absolute location.
- getFileSize() : int
- Get file size.
- getInputStream() : string
- Get input stream.
- getKey() : string
- Get key.
- getLocation() : string
- Get location.
- getName() : string
- Get name.
- getOffset() : int
- Get offset.
- merge() : int
- Merge 2 or more files.
- open() : resource
- Open file in given mode.
- read() : string
- Read data from file.
- seek() : int
- Move file pointer to given offset.
- setChecksum() : File
- Set checksum.
- setFilePath() : File
- Set absolute file location.
- setFileSize() : File
- Set file size.
- setKey() : File
- Set key.
- setLocation() : File
- Set location.
- setMeta() : File
- Set file meta.
- setName() : File
- Set name.
- setOffset() : File
- Set offset.
- setUploadMetadata() : File
- upload() : int
- Upload file to server.
- write() : int
- Write data to file.
Constants
APPEND_BINARY
public
mixed
APPEND_BINARY
= 'ab'
Tags
CHUNK_SIZE
public
mixed
CHUNK_SIZE
= 8192
Tags
INPUT_STREAM
public
mixed
INPUT_STREAM
= 'php://input'
Tags
READ_BINARY
public
mixed
READ_BINARY
= 'rb'
Tags
Properties
$cache
protected
Cacheable
$cache
$checksum
protected
string
$checksum
$filePath
protected
string
$filePath
$fileSize
protected
int
$fileSize
$key
protected
string
$key
$location
protected
string
$location
$name
protected
string
$name
$offset
protected
int
$offset
$uploadMetadata
private
array<string|int, string>
$uploadMetadata
= []
Methods
__construct()
File constructor.
public
__construct([string|null $name = null ][, Cacheable|null $cache = null ]) : mixed
Parameters
- $name : string|null = null
- $cache : Cacheable|null = null
Return values
mixed —close()
Close file.
public
close( $handle) : bool
Parameters
Return values
bool —copy()
Copy file from source to destination.
public
copy(string $source, string $destination) : bool
Parameters
- $source : string
- $destination : string
Return values
bool —delete()
Delete file and/or folder.
public
delete(array<string|int, mixed> $files[, bool $folder = false ]) : bool
Parameters
- $files : array<string|int, mixed>
- $folder : bool = false
Return values
bool —deleteFiles()
Delete multiple files.
public
deleteFiles(array<string|int, mixed> $files) : bool
Parameters
- $files : array<string|int, mixed>
Return values
bool —details()
Get file meta.
public
details() : array<string|int, mixed>
Return values
array<string|int, mixed> —exists()
Check if file to read exists.
public
exists(string $filePath[, string $mode = self::READ_BINARY ]) : bool
Parameters
- $filePath : string
- $mode : string = self::READ_BINARY
Tags
Return values
bool —getChecksum()
Get checksum.
public
getChecksum() : string
Return values
string —getFilePath()
Get absolute location.
public
getFilePath() : string
Return values
string —getFileSize()
Get file size.
public
getFileSize() : int
Return values
int —getInputStream()
Get input stream.
public
getInputStream() : string
Return values
string —getKey()
Get key.
public
getKey() : string
Return values
string —getLocation()
Get location.
public
getLocation() : string
Return values
string —getName()
Get name.
public
getName() : string
Return values
string —getOffset()
Get offset.
public
getOffset() : int
Return values
int —merge()
Merge 2 or more files.
public
merge(array<string|int, mixed> $files) : int
Parameters
- $files : array<string|int, mixed>
-
File data with meta info.
Return values
int —open()
Open file in given mode.
public
open(string $filePath, string $mode) : resource
Parameters
- $filePath : string
- $mode : string
Tags
Return values
resource —read()
Read data from file.
public
read(resource $handle, int $chunkSize) : string
Parameters
- $handle : resource
- $chunkSize : int
Tags
Return values
string —seek()
Move file pointer to given offset.
public
seek(resource $handle, int $offset[, int $whence = SEEK_SET ]) : int
Parameters
- $handle : resource
- $offset : int
- $whence : int = SEEK_SET
Tags
Return values
int —setChecksum()
Set checksum.
public
setChecksum(string $checksum) : File
Parameters
- $checksum : string
Return values
File —setFilePath()
Set absolute file location.
public
setFilePath(string $path) : File
Parameters
- $path : string
Return values
File —setFileSize()
Set file size.
public
setFileSize(int $size) : File
Parameters
- $size : int
Return values
File —setKey()
Set key.
public
setKey(string $key) : File
Parameters
- $key : string
Return values
File —setLocation()
Set location.
public
setLocation(string $location) : File
Parameters
- $location : string
Return values
File —setMeta()
Set file meta.
public
setMeta(int $offset, int $fileSize, string $filePath[, string $location = null ]) : File
Parameters
- $offset : int
- $fileSize : int
- $filePath : string
- $location : string = null
Return values
File —setName()
Set name.
public
setName(string $name) : File
Parameters
- $name : string
Return values
File —setOffset()
Set offset.
public
setOffset(int $offset) : File
Parameters
- $offset : int
Return values
File —setUploadMetadata()
public
setUploadMetadata(array<string|int, string> $metadata) : File
Parameters
- $metadata : array<string|int, string>
Return values
File —upload()
Upload file to server.
public
upload(int $totalBytes) : int
Parameters
- $totalBytes : int
Tags
Return values
int —write()
Write data to file.
public
write(resource $handle, string $data[, int|null $length = null ]) : int
Parameters
- $handle : resource
- $data : string
- $length : int|null = null