‪TYPO3CMS  10.4
TYPO3\CMS\Core\Resource\FileInterface Interface Reference
Inheritance diagram for TYPO3\CMS\Core\Resource\FileInterface:
TYPO3\CMS\Core\Resource\ResourceInterface TYPO3\CMS\Core\Resource\AbstractFile TYPO3\CMS\Core\Resource\FileReference TYPO3\CMS\Core\Resource\File TYPO3\CMS\Core\Resource\ProcessedFile

Public Member Functions

bool hasProperty ($key)
 
string getProperty ($key)
 
int getSize ()
 
string getSha1 ()
 
string getNameWithoutExtension ()
 
string getExtension ()
 
string getMimeType ()
 
int getModificationTime ()
 
int getCreationTime ()
 
string getContents ()
 
File setContents ($contents)
 
bool delete ()
 
File rename ($newName, $conflictMode=DuplicationBehavior::RENAME)
 
string null getPublicUrl ($relativeToCurrentScript=false)
 
bool isIndexed ()
 
string getForLocalProcessing ($writable=true)
 
array toArray ()
 
- ‪Public Member Functions inherited from ‪TYPO3\CMS\Core\Resource\ResourceInterface
string getIdentifier ()
 
string getName ()
 
ResourceStorage getStorage ()
 
string getHashedIdentifier ()
 
FolderInterface getParentFolder ()
 

Detailed Description

File Interface

Definition at line 21 of file FileInterface.php.

Member Function Documentation

◆ delete()

bool TYPO3\CMS\Core\Resource\FileInterface::delete ( )

Deletes this file from its storage. This also means that this object becomes useless.

Returns
‪bool TRUE if deletion succeeded

Implemented in TYPO3\CMS\Core\Resource\AbstractFile, and TYPO3\CMS\Core\Resource\FileReference.

◆ getContents()

string TYPO3\CMS\Core\Resource\FileInterface::getContents ( )

Get the contents of this file

Returns
‪string File contents

Implemented in TYPO3\CMS\Core\Resource\AbstractFile, TYPO3\CMS\Core\Resource\FileReference, and TYPO3\CMS\Core\Resource\File.

◆ getCreationTime()

int TYPO3\CMS\Core\Resource\FileInterface::getCreationTime ( )

Returns the creation time of the file as Unix timestamp

Returns
‪int

Implemented in TYPO3\CMS\Core\Resource\FileReference, and TYPO3\CMS\Core\Resource\AbstractFile.

◆ getExtension()

◆ getForLocalProcessing()

string TYPO3\CMS\Core\Resource\FileInterface::getForLocalProcessing (   $writable = true)

Returns a path to a local version of this file to process it locally (e.g. with some system tool). 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
bool$writable‪Set this to FALSE if you only want to do read operations on the file.
Returns
‪string

Implemented in TYPO3\CMS\Core\Resource\AbstractFile, and TYPO3\CMS\Core\Resource\FileReference.

Referenced by TYPO3\CMS\Core\Resource\TextExtraction\PlainTextExtractor\extractText().

◆ getMimeType()

◆ getModificationTime()

int TYPO3\CMS\Core\Resource\FileInterface::getModificationTime ( )

Returns the modification time of the file as Unix timestamp

Returns
‪int

Implemented in TYPO3\CMS\Core\Resource\FileReference, and TYPO3\CMS\Core\Resource\AbstractFile.

◆ getNameWithoutExtension()

string TYPO3\CMS\Core\Resource\FileInterface::getNameWithoutExtension ( )

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

Returns
‪string

Implemented in TYPO3\CMS\Core\Resource\FileReference, and TYPO3\CMS\Core\Resource\AbstractFile.

◆ getProperty()

◆ getPublicUrl()

string null TYPO3\CMS\Core\Resource\FileInterface::getPublicUrl (   $relativeToCurrentScript = false)

Returns a publicly accessible URL for this file

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
bool$relativeToCurrentScript‪Determines whether the URL returned should be relative to the current script, in case it is relative at all (only for the LocalDriver)
Returns
‪string|null NULL if file is missing or deleted, the generated url otherwise

Implemented in TYPO3\CMS\Core\Resource\ProcessedFile, TYPO3\CMS\Core\Resource\AbstractFile, TYPO3\CMS\Core\Resource\FileReference, and TYPO3\CMS\Core\Resource\File.

Referenced by TYPO3\CMS\Extbase\Service\ImageService\getImageUri(), TYPO3\CMS\Core\Resource\Rendering\AudioTagRenderer\render(), and TYPO3\CMS\Core\Resource\Rendering\VideoTagRenderer\render().

◆ getSha1()

string TYPO3\CMS\Core\Resource\FileInterface::getSha1 ( )

Returns the Sha1 of this file

Returns
‪string

Implemented in TYPO3\CMS\Core\Resource\FileReference, TYPO3\CMS\Core\Resource\AbstractFile, and TYPO3\CMS\Core\Resource\File.

◆ getSize()

int TYPO3\CMS\Core\Resource\FileInterface::getSize ( )

◆ hasProperty()

bool TYPO3\CMS\Core\Resource\FileInterface::hasProperty (   $key)

◆ isIndexed()

bool TYPO3\CMS\Core\Resource\FileInterface::isIndexed ( )

Returns TRUE if this file is indexed

Returns
‪bool

Implemented in TYPO3\CMS\Core\Resource\FileReference, TYPO3\CMS\Core\Resource\ProcessedFile, and TYPO3\CMS\Core\Resource\File.

◆ rename()

File TYPO3\CMS\Core\Resource\FileInterface::rename (   $newName,
  $conflictMode = DuplicationBehavior::RENAME 
)

Renames this file.

Parameters
string$newName‪The new file name
string$conflictMode
Returns
File

Implemented in TYPO3\CMS\Core\Resource\AbstractFile, and TYPO3\CMS\Core\Resource\FileReference.

◆ setContents()

File TYPO3\CMS\Core\Resource\FileInterface::setContents (   $contents)

Replace the current file contents with the given string.

@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

Parameters
string$contents‪The contents to write to the file.
Returns
File The file object (allows chaining).

Implemented in TYPO3\CMS\Core\Resource\AbstractFile, TYPO3\CMS\Core\Resource\FileReference, TYPO3\CMS\Core\Resource\ProcessedFile, and TYPO3\CMS\Core\Resource\File.

◆ toArray()

array TYPO3\CMS\Core\Resource\FileInterface::toArray ( )

Returns an array representation of the file. (This is used by the generic listing module vidi when displaying file records.)

Returns
‪array 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.

Implemented in TYPO3\CMS\Core\Resource\FileReference, TYPO3\CMS\Core\Resource\ProcessedFile, and TYPO3\CMS\Core\Resource\File.