PHP 클래스 uploader

S('class/uploader')->sendToSae() S('class/uploader')->sendToKupan() S('class/uploader')->sendToQiniu() S('class/uploader')->sendToTietu()
저자: suconghou
파일 보기 프로젝트 열기: anchorcms/anchor-cms 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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