Phpxforms documentation

FileApi
in package

File APIs for browsing and interaction with files

Tags
author

DaVee8k

license

Lesser General Public License 2.1 or later; see http://www.gnu.org/licenses/lgpl-2.1.html

version
0.87dev

Table of Contents

Properties

$msgs  : array<string, string>
$error  : string
$location  : string
$path  : string

Methods

__construct()  : mixed
clonePost()  : bool
Copy file to specific array space
cropPath()  : string
Remove current $path from inserted path
downloadFile()  : bool
Download file to client
escape()  : string
Escape filename and add quotes
exist()  : bool
File exists
fakeUpload()  : void
Setup $_FILE input
filterPath()  : string
Remove /../ up directory from url
fixPath()  : string
Add DIRECTORY_SEPARATOR
getError()  : string
Return last error message
getMime()  : string
Get file MIME type
getPath()  : string
Return current path
getSize()  : int
Get file size
getUpload()  : mixed
Get info form $_FILES
getUrlData()  : string|null
Get file with CURL
isUpload()  : bool
Check if uploaded file is ok
loadFiles()  : array<string, array{NAME: string, DATE: int, SIZE: int, MIME: string}>
Get list of files in directory
makePath()  : string
Return full formatted path with $dir
setPath()  : bool
Set current path if exists
setUpload()  : void
Set value in $_FILES
getMsg()  : string
Get message text

Properties

$msgs

public static array<string, string> $msgs = ['FILE' => 'Soubor', 'DIR' => 'Složka', 'NO_UPLOAD' => 'Nebyl zadán soubor pro nahrání.', 'UPLOAD_MAX_SIZE' => 'Soubor %s překročil maximální velikost.', 'UPLOAD_STOPPED' => 'Nahrávání souboru %s bylo přerušeno.', 'UPLOAD_ERROR' => 'Soubor %1$s nelze nahrát (chyba %2$d).', 'NO_RIGHTS' => 'Nemáte právo zápisu do: %s.', 'NO_NAME' => 'Nebyl zadán nový název.', 'EXIST' => ' %s již existuje.', 'NOT_EMPTY' => ' %s není prázdný.', 'NOT_FOUND' => ' %s nenalezena.', 'NOT_MOVE' => ' %s nelze zkopírovat.', 'NOT_COPY' => ' %s nelze přesunout.', 'NOT_RENAME' => ' %s nelze přejmenovat.', 'NOT_DELETE' => ' %s nelze odstranit.', 'CURL_ERROR' => 'Curl error: %d', 'GENERAL_ERROR' => 'General error: %s']

$location

protected string $location

Methods

__construct()

public __construct(string $loc) : mixed
Parameters
$loc : string
Tags
throws
InvalidArgumentException

clonePost()

Copy file to specific array space

public clonePost(string $fromMark, array<int, mixed>|int|null $fromLevels, string $toMark, array<int, mixed>|int|null $toLevels) : bool
Parameters
$fromMark : string
$fromLevels : array<int, mixed>|int|null
$toMark : string
$toLevels : array<int, mixed>|int|null
Return values
bool

cropPath()

Remove current $path from inserted path

public cropPath(string $dir) : string
Parameters
$dir : string
Return values
string

downloadFile()

Download file to client

public downloadFile(string $dir, string $file[, bool $stream = false ]) : bool
Parameters
$dir : string
$file : string
$stream : bool = false
Return values
bool

escape()

Escape filename and add quotes

public static escape(string $value[, string $quote = "'" ]) : string
Parameters
$value : string
$quote : string = "'"
Return values
string

exist()

File exists

public exist(string $dir[, string|null $file = null ][, bool $caseSensitive = false ]) : bool
Parameters
$dir : string
$file : string|null = null
$caseSensitive : bool = false
Return values
bool

fakeUpload()

Setup $_FILE input

public fakeUpload(string $input, string $filePath, string $name[, int|null $id = null ]) : void
Parameters
$input : string
$filePath : string
$name : string
$id : int|null = null
Tags
throws
InvalidArgumentException

filterPath()

Remove /../ up directory from url

public filterPath(string $dir) : string
Parameters
$dir : string
Return values
string

fixPath()

Add DIRECTORY_SEPARATOR

public fixPath(string $dir[, bool $isDir = true ]) : string
Parameters
$dir : string
$isDir : bool = true
Return values
string

getError()

Return last error message

public getError() : string
Return values
string

getMime()

Get file MIME type

public getMime(string $url) : string
Parameters
$url : string
Return values
string

getPath()

Return current path

public getPath() : string
Return values
string

getSize()

Get file size

public getSize(string $url) : int
Parameters
$url : string
Return values
int

getUpload()

Get info form $_FILES

public getUpload(string $input, string $type[, int|null $id = null ]) : mixed
Parameters
$input : string
$type : string
$id : int|null = null

getUrlData()

Get file with CURL

public getUrlData(string $url) : string|null
Parameters
$url : string
Return values
string|null

isUpload()

Check if uploaded file is ok

public isUpload(string $input[, int|null $id = null ][, bool $emptyIsOk = false ]) : bool
Parameters
$input : string
$id : int|null = null
$emptyIsOk : bool = false
Return values
bool

loadFiles()

Get list of files in directory

public loadFiles([string $dir = '' ]) : array<string, array{NAME: string, DATE: int, SIZE: int, MIME: string}>
Parameters
$dir : string = ''
Return values
array<string, array{NAME: string, DATE: int, SIZE: int, MIME: string}>

makePath()

Return full formatted path with $dir

public makePath(string $dir[, bool $isDir = true ]) : string
Parameters
$dir : string
$isDir : bool = true
Return values
string

setPath()

Set current path if exists

public setPath(string $dir) : bool
Parameters
$dir : string
Return values
bool

setUpload()

Set value in $_FILES

public setUpload(string $input, string $type, mixed $val[, int|null $id = null ]) : void
Parameters
$input : string
$type : string
$val : mixed
$id : int|null = null

getMsg()

Get message text

protected getMsg(string $msg[, string|int|null $param = null ][, string|null $type = null ][, int|null $num = null ]) : string
Parameters
$msg : string
$param : string|int|null = null
$type : string|null = null
$num : int|null = null
Return values
string

        
On this page

Search results