Nextcloud PHP API (master)

FileInfo

Interface FileInfo

Tags
since
7.0.0

Table of Contents

Constants

BLACKLIST_FILES_REGEX  = '\\.(part|filepart)$'
MIMETYPE_FOLDER  = 'httpd/unix-directory'
SPACE_NOT_COMPUTED  = -1
SPACE_UNKNOWN  = -2
SPACE_UNLIMITED  = -3
TYPE_FILE  = 'file'
TYPE_FOLDER  = 'dir'

Methods

getChecksum()  : string
Get the stored checksum(s) for this file
getCreationTime()  : int
Get the creation date as unix timestamp
getEtag()  : string
Get the Etag of the file or folder
getExtension()  : string
Get the extension of the file
getId()  : int|null
Get the file id of the file or folder
getInternalPath()  : string
Get the path relative to the storage
getMetadata()  : array<string, int|string|bool|float|array<string|int, string>|array<string|int, int>>
Get the metadata, if available
getMimePart()  : string
Get the first part of the mimetype of the file or folder i.e. 'image'
getMimetype()  : string
Get the full mimetype of the file or folder i.e. 'image/png'
getMountPoint()  : IMountPoint
Get the mountpoint the file belongs to
getMtime()  : int
Get the last modified date as timestamp for the file or folder
getName()  : string
Get the name of the file or folder
getOwner()  : IUser|null
Get the owner of the file
getParentId()  : int
Get the fileid or the parent folder or -1 if this item has no parent folder (because it is the root)
getPath()  : string
Get the absolute path
getPermissions()  : int
Get the permissions of the file or folder as bitmasked combination of the following constants \OCP\Constants::PERMISSION_CREATE \OCP\Constants::PERMISSION_READ \OCP\Constants::PERMISSION_UPDATE \OCP\Constants::PERMISSION_DELETE \OCP\Constants::PERMISSION_SHARE \OCP\Constants::PERMISSION_ALL
getSize()  : int|float
Get the size in bytes for the file or folder
getStorage()  : IStorage
Get the storage the file or folder is storage on
getType()  : string
Check whether this is a file or a folder
getUploadTime()  : int
Get the upload date as unix timestamp
isCreatable()  : bool
Check whether new files or folders can be created inside this folder
isDeletable()  : bool
Check if a file or folder can be deleted
isEncrypted()  : bool
Check whether the file is encrypted
isMounted()  : bool
Check if a file or folder is mounted
isReadable()  : bool
Check if the file or folder is readable
isShareable()  : bool
Check if a file or folder can be shared
isShared()  : bool
Check if a file or folder is shared
isUpdateable()  : bool
Check if a file is writable

Constants

BLACKLIST_FILES_REGEX

public mixed BLACKLIST_FILES_REGEX = '\\.(part|filepart)$'
Tags
const

\OCP\Files\FileInfo::BLACKLIST_FILES_REGEX Return regular expression to test filenames against (blacklisting)

since
12.0.0

MIMETYPE_FOLDER

public mixed MIMETYPE_FOLDER = 'httpd/unix-directory'
Tags
since
9.1.0

SPACE_NOT_COMPUTED

public mixed SPACE_NOT_COMPUTED = -1
Tags
const

\OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value

since
8.0.0

SPACE_UNKNOWN

public mixed SPACE_UNKNOWN = -2
Tags
const

\OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value

since
8.0.0

SPACE_UNLIMITED

public mixed SPACE_UNLIMITED = -3
Tags
const

\OCP\Files\FileInfo::SPACE_UNLIMITED Return value for unlimited space

since
8.0.0

TYPE_FILE

public mixed TYPE_FILE = 'file'
Tags
since
7.0.0

TYPE_FOLDER

public mixed TYPE_FOLDER = 'dir'
Tags
since
7.0.0

Methods

getChecksum()

Get the stored checksum(s) for this file

public getChecksum() : string

Checksums are stored in the format TYPE:CHECKSUM, here may be multiple checksums separated by a single space e.g. MD5:d3b07384d113edec49eaa6238ad5ff00 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15

Tags
since
9.0.0
Return values
string

getCreationTime()

Get the creation date as unix timestamp

public getCreationTime() : int

If the creation time is not known, 0 will be returned

creation time is not set automatically by the server and is generally only available for files uploaded by the sync clients

Tags
since
18.0.0
Return values
int

getEtag()

Get the Etag of the file or folder

public getEtag() : string
Tags
since
7.0.0
Return values
string

getExtension()

Get the extension of the file

public getExtension() : string
Tags
since
15.0.0
Return values
string

getId()

Get the file id of the file or folder

public getId() : int|null
Tags
since
7.0.0
Return values
int|null

getInternalPath()

Get the path relative to the storage

public getInternalPath() : string
Tags
since
7.0.0
Return values
string

getMetadata()

Get the metadata, if available

public getMetadata() : array<string, int|string|bool|float|array<string|int, string>|array<string|int, int>>
Tags
since
28.0.0
Return values
array<string, int|string|bool|float|array<string|int, string>|array<string|int, int>>

getMimePart()

Get the first part of the mimetype of the file or folder i.e. 'image'

public getMimePart() : string
Tags
since
7.0.0
Return values
string

getMimetype()

Get the full mimetype of the file or folder i.e. 'image/png'

public getMimetype() : string
Tags
since
7.0.0
Return values
string

getMtime()

Get the last modified date as timestamp for the file or folder

public getMtime() : int
Tags
since
7.0.0
Return values
int

getName()

Get the name of the file or folder

public getName() : string
Tags
since
7.0.0
Return values
string

getOwner()

Get the owner of the file

public getOwner() : IUser|null
Tags
since
9.0.0
Return values
IUser|null

getParentId()

Get the fileid or the parent folder or -1 if this item has no parent folder (because it is the root)

public getParentId() : int
Tags
since
28.0.0
Return values
int

getPath()

Get the absolute path

public getPath() : string
Tags
since
7.0.0
Return values
string

getPermissions()

Get the permissions of the file or folder as bitmasked combination of the following constants \OCP\Constants::PERMISSION_CREATE \OCP\Constants::PERMISSION_READ \OCP\Constants::PERMISSION_UPDATE \OCP\Constants::PERMISSION_DELETE \OCP\Constants::PERMISSION_SHARE \OCP\Constants::PERMISSION_ALL

public getPermissions() : int
Tags
since
7.0.0
  • namespace of constants has changed in 8.0.0
Return values
int

getSize()

Get the size in bytes for the file or folder

public getSize([bool $includeMounts = true ]) : int|float
Parameters
$includeMounts : bool = true

whether or not to include the size of any sub mounts, since 16.0.0

Tags
since
7.0.0
Return values
int|float

getStorage()

Get the storage the file or folder is storage on

public getStorage() : IStorage
Tags
since
7.0.0
Return values
IStorage

getType()

Check whether this is a file or a folder

public getType() : string
Tags
since
7.0.0
Return values
string

\OCP\Files\FileInfo::TYPE_FILE|\OCP\Files\FileInfo::TYPE_FOLDER

getUploadTime()

Get the upload date as unix timestamp

public getUploadTime() : int

If the upload time is not known, 0 will be returned

Upload time will be set automatically by the server for files uploaded over DAV files created by Nextcloud apps generally do not have an the upload time set

Tags
since
18.0.0
Return values
int

isCreatable()

Check whether new files or folders can be created inside this folder

public isCreatable() : bool
Tags
since
8.0.0
Return values
bool

isDeletable()

Check if a file or folder can be deleted

public isDeletable() : bool
Tags
since
7.0.0
Return values
bool

isEncrypted()

Check whether the file is encrypted

public isEncrypted() : bool
Tags
since
7.0.0
Return values
bool

isMounted()

Check if a file or folder is mounted

public isMounted() : bool
Tags
since
7.0.0
Return values
bool

isReadable()

Check if the file or folder is readable

public isReadable() : bool
Tags
since
7.0.0
Return values
bool

isShareable()

Check if a file or folder can be shared

public isShareable() : bool
Tags
since
7.0.0
Return values
bool

isShared()

Check if a file or folder is shared

public isShared() : bool
Tags
since
7.0.0
Return values
bool

isUpdateable()

Check if a file is writable

public isUpdateable() : bool
Tags
since
7.0.0
Return values
bool

        
On this page

Search results