Nextcloud PHP API (master)

Files
in package

This class provides access to the internal filesystem abstraction layer. Use this class exclusively if you want to access files

Tags
since
5.0.0

Table of Contents

Methods

buildNotExistingFileName()  : string
Adds a suffix to the name in case the file exists
getMimeType()  : string
Get the mimetype form a local file
rmdirr()  : bool
Recursive deletion of folders
searchByMime()  : array<string|int, mixed>
Search for files by mimetype
streamCopy()  : int|array<string|int, mixed>
Copy the contents of one stream to another

Methods

buildNotExistingFileName()

Adds a suffix to the name in case the file exists

public static buildNotExistingFileName(string $path, string $filename) : string

use getNonExistingName of the OCP\Files\Folder object

Parameters
$path : string
$filename : string
Tags
since
5.0.0
Return values
string

getMimeType()

Get the mimetype form a local file

public static getMimeType(string $path) : string
Parameters
$path : string
Tags
since
5.0.0
Return values
string

does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead

rmdirr()

Recursive deletion of folders

public static rmdirr(string $dir[, bool $deleteSelf = true ]) : bool
Parameters
$dir : string

path to the folder

$deleteSelf : bool = true

if set to false only the content of the folder will be deleted

Tags
since
5.0.0
since
32.0.0

added the $deleteSelf parameter

Return values
bool

searchByMime()

Search for files by mimetype

public static searchByMime(string $mimetype) : array<string|int, mixed>
Parameters
$mimetype : string
Tags
since
6.0.0
Return values
array<string|int, mixed>

streamCopy()

Copy the contents of one stream to another

public static streamCopy(resource $source, resource $target[, T $includeResult = null ]) : int|array<string|int, mixed>
Parameters
$source : resource
$target : resource
$includeResult : T = null
Tags
template
psalm-return

(T is true ? array{0: int, 1: bool} : int)

since
5.0.0
since
32.0.0

added $includeResult parameter

Return values
int|array<string|int, mixed>

        
On this page

Search results