$Folder
$Folder : \Cake\Filesystem\Folder
Folder object of the file
Convenience class for reading, writing and appending to files.
$Folder : \Cake\Filesystem\Folder
Folder object of the file
open(string $mode = 'r', boolean $force = false) : boolean
Opens the current file with a given $mode
string | $mode | A valid 'fopen' mode string (r|w|a ...) |
boolean | $force | If true then the file will be re-opened even if its already opened, otherwise it won't |
True on success, false on failure
read(string|boolean $bytes = false, string $mode = 'rb', boolean $force = false) : string|false
Return the contents of this file as a string.
string|boolean | $bytes | where to start |
string | $mode | A |
boolean | $force | If true then the file will be re-opened even if its already opened, otherwise it won't |
string on success, false on failure
offset(integer|boolean $offset = false, integer $seek = SEEK_SET) : integer|boolean
Sets or gets the offset for the currently opened file.
integer|boolean | $offset | The $offset in bytes to seek. If set to false then the current offset is returned. |
integer | $seek | PHP Constant SEEK_SET | SEEK_CUR | SEEK_END determining what the $offset is relative to |
True on success, false on failure (set mode), false on failure or integer offset on success (get mode)
prepare(string $data, boolean $forceWindows = false) : string
Prepares an ASCII string for writing. Converts line endings to the correct terminator for the current platform. If Windows, "\r\n" will be used, all other platforms will use "\n"
string | $data | Data to prepare for writing. |
boolean | $forceWindows | If true forces Windows new line string. |
The with converted line endings.
write(string $data, string $mode = 'w', boolean $force = false) : boolean
Write given data to this file.
string | $data | Data to write to this File. |
string | $mode | Mode of writing. {@link https://secure.php.net/fwrite See fwrite()}. |
boolean | $force | Force the file to open |
Success
safe(string|null $name = null, string|null $ext = null) : string
Makes file name safe for saving
string|null | $name | The name of the file to make safe if different from $this->name |
string|null | $ext | The name of the extension to make safe if different from $this->ext |
The extension of the file
md5(integer|boolean $maxsize = 5) : string|false
Get md5 Checksum of file with previous check of Filesize
integer|boolean | $maxsize | in MB or true to force |
md5 Checksum {@link https://secure.php.net/md5_file See md5_file()}, or false in case of an error
folder() : \Cake\Filesystem\Folder
Returns the current folder.
Current folder