FileSystem
extends Base
in package
FileSystem Storage
This class uploads files to a designated directory on the filesystem.
Tags
Table of Contents
Properties
- $directory : string
- Upload directory
- $overwrite : bool
- Overwrite existing files?
Methods
- __construct() : mixed
- Constructor
- upload() : bool
- Upload
- moveUploadedFile() : bool
- Move uploaded file
Properties
$directory
Upload directory
protected
string
$directory
$overwrite
Overwrite existing files?
protected
bool
$overwrite
Methods
__construct()
Constructor
public
__construct(string $directory[, bool $overwrite = false ]) : mixed
Parameters
- $directory : string
-
Relative or absolute path to upload directory
- $overwrite : bool = false
-
Should this overwrite existing files?
Tags
upload()
Upload
public
upload(File $file[, string $newName = null ]) : bool
Parameters
- $file : File
-
The file object to upload
- $newName : string = null
-
Give the file it a new name
Tags
Return values
boolmoveUploadedFile()
Move uploaded file
protected
moveUploadedFile(string $source, string $destination) : bool
This method allows us to stub this method in unit tests to avoid
hard dependency on the move_uploaded_file
function.
Parameters
- $source : string
-
The source file
- $destination : string
-
The destination file