PHP Класс uploader

S('class/uploader')->sendToSae() S('class/uploader')->sendToKupan() S('class/uploader')->sendToQiniu() S('class/uploader')->sendToTietu()
Автор: suconghou
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$destination string The path where uploaded files will be moved to
$extensions array Holds array of valid file extensions

Открытые методы

Метод Описание
__construct ( $destination, $extensions = [] ) Create a new instance of the uploader
set_destination ( $path ) Sets the upload destination path
set_extensions ( $extensions ) Sets the upload accepted extensions
upload ( $file, $filename = null ) : string Upload a file

Защищенные методы

Метод Описание
format_filename ( $filename ) : string Strips none alphanumeric and dash characters
get_error_message ( $error ) : string Translates error codes to error messages
get_filename ( $filename ) : string Creates a friendly file name
validate ( $file ) Validates the passed $_FILES value and extension

Описание методов

__construct() публичный Метод

Create a new instance of the uploader
public __construct ( $destination, $extensions = [] )

format_filename() защищенный Метод

Strips none alphanumeric and dash characters
protected format_filename ( $filename ) : string
Результат string

get_error_message() защищенный Метод

Translates error codes to error messages
protected get_error_message ( $error ) : string
Результат string

get_filename() защищенный Метод

Creates a friendly file name
protected get_filename ( $filename ) : string
Результат string

set_destination() публичный Метод

Sets the upload destination path
public set_destination ( $path )

set_extensions() публичный Метод

Sets the upload accepted extensions
public set_extensions ( $extensions )

upload() публичный Метод

Upload a file
public upload ( $file, $filename = null ) : string
Результат string

validate() защищенный Метод

Validates the passed $_FILES value and extension
protected validate ( $file )

Описание свойств

$destination защищенное свойство

The path where uploaded files will be moved to
protected string $destination
Результат string

$extensions защищенное свойство

Holds array of valid file extensions
protected array $extensions
Результат array