FileInterface extends ResourceInterface
File Interface
Table of Contents
Methods
- delete() : bool
- Deletes this file from its storage. This also means that this object becomes useless.
- getContents() : string
- Get the contents of this file
- getCreationTime() : int
- Returns the creation time of the file as Unix timestamp
- getExtension() : string
- Get the file extension
- getForLocalProcessing() : string
- Returns a path to a local version of this file to process it locally (e.g. with some system tool).
- getHashedIdentifier() : string
- Get hashed identifier
- getIdentifier() : string
- Returns the identifier of this file
- getMimeType() : string
- Get the MIME type of this file
- getModificationTime() : int
- Returns the modification time of the file as Unix timestamp
- getName() : string
- Returns the name of this file
- getNameWithoutExtension() : string
- Returns the basename (the name without extension) of this file.
- getParentFolder() : FolderInterface
- getProperty() : string
- Get the value of the $key property.
- getPublicUrl() : string|null
- Returns a publicly accessible URL for this file
- getSha1() : string
- Returns the Sha1 of this file
- getSize() : int
- Returns the size of this file
- getStorage() : ResourceStorage
- Get the storage this file is located in
- hasProperty() : bool
- Returns true if the given key exists for this file.
- isIndexed() : bool
- Returns TRUE if this file is indexed
- rename() : File
- Renames this file.
- setContents() : File
- Replace the current file contents with the given string.
- toArray() : array<string|int, mixed>
- Returns an array representation of the file.
Methods
delete()
Deletes this file from its storage. This also means that this object becomes useless.
public
delete() : bool
Return values
bool —TRUE if deletion succeeded
getContents()
Get the contents of this file
public
getContents() : string
Return values
string —File contents
getCreationTime()
Returns the creation time of the file as Unix timestamp
public
getCreationTime() : int
Return values
intgetExtension()
Get the file extension
public
getExtension() : string
Return values
string —The file extension
getForLocalProcessing()
Returns a path to a local version of this file to process it locally (e.g. with some system tool).
public
getForLocalProcessing([bool $writable = true ]) : string
If the file is normally located on a remote storages, this creates a local copy. If the file is already on the local system, this only makes a new copy if $writable is set to TRUE.
Parameters
- $writable : bool = true
-
Set this to FALSE if you only want to do read operations on the file.
Return values
stringgetHashedIdentifier()
Get hashed identifier
public
getHashedIdentifier() : string
Return values
stringgetIdentifier()
Returns the identifier of this file
public
getIdentifier() : string
Return values
stringgetMimeType()
Get the MIME type of this file
public
getMimeType() : string
Return values
string —mime type
getModificationTime()
Returns the modification time of the file as Unix timestamp
public
getModificationTime() : int
Return values
intgetName()
Returns the name of this file
public
getName() : string
Return values
stringgetNameWithoutExtension()
Returns the basename (the name without extension) of this file.
public
getNameWithoutExtension() : string
Return values
stringgetParentFolder()
public
getParentFolder() : FolderInterface
Return values
FolderInterfacegetProperty()
Get the value of the $key property.
public
getProperty(string $key) : string
Parameters
- $key : string
Return values
stringgetPublicUrl()
Returns a publicly accessible URL for this file
public
getPublicUrl() : string|null
WARNING: Access to the file may be restricted by further means, e.g. some web-based authentication. You have to take care of this yourself.
Return values
string|null —NULL if file is missing or deleted, the generated url otherwise
getSha1()
Returns the Sha1 of this file
public
getSha1() : string
Return values
stringgetSize()
Returns the size of this file
public
getSize() : int
Return values
intgetStorage()
Get the storage this file is located in
public
getStorage() : ResourceStorage
Return values
ResourceStoragehasProperty()
Returns true if the given key exists for this file.
public
hasProperty(string $key) : bool
Parameters
- $key : string
Return values
boolisIndexed()
Returns TRUE if this file is indexed
public
isIndexed() : bool
Return values
boolrename()
Renames this file.
public
rename(string $newName[, string $conflictMode = DuplicationBehavior::RENAME ]) : File
Parameters
- $newName : string
-
The new file name
- $conflictMode : string = DuplicationBehavior::RENAME
Return values
FilesetContents()
Replace the current file contents with the given string.
public
setContents(string $contents) : File
Parameters
- $contents : string
-
The contents to write to the file.
Tags
Return values
File —The file object (allows chaining).
toArray()
Returns an array representation of the file.
public
toArray() : array<string|int, mixed>
(This is used by the generic listing module vidi when displaying file records.)
Return values
array<string|int, mixed> —Array of main data of the file. Don't rely on all data to be present here, it's just a selection of the most relevant information.