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
int

getExtension()

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
string

getHashedIdentifier()

Get hashed identifier

public getHashedIdentifier() : string
Return values
string

getIdentifier()

Returns the identifier of this file

public getIdentifier() : string
Return values
string

getMimeType()

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
int

getName()

Returns the name of this file

public getName() : string
Return values
string

getNameWithoutExtension()

Returns the basename (the name without extension) of this file.

public getNameWithoutExtension() : string
Return values
string

getProperty()

Get the value of the $key property.

public getProperty(string $key) : string
Parameters
$key : string
Return values
string

getPublicUrl()

Returns a publicly accessible URL for this file

public getPublicUrl([bool $relativeToCurrentScript = false ]) : 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.

Parameters
$relativeToCurrentScript : bool = false

Determines whether the URL returned should be relative to the current script, in case it is relative at all (only for the LocalDriver). Deprecated since TYPO3 v11, will be removed in TYPO3 v12.0

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
string

getSize()

Returns the size of this file

public getSize() : int
Return values
int

hasProperty()

Returns true if the given key exists for this file.

public hasProperty(string $key) : bool
Parameters
$key : string
Return values
bool

isIndexed()

Returns TRUE if this file is indexed

public isIndexed() : bool
Return values
bool

rename()

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
File

setContents()

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
TODO

: Consider to remove this function from the interface, as its

TODO

: At the same time, it could be considered whether to make the whole

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.


        
On this page

Search results