PHP Класс Uploadcare\Uploader

Показать файл Открыть проект

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

Метод Описание
__construct ( Api $api ) Constructor
createGroup ( array $files ) : uploadcare\Group Create group from array of File objects
fromContent ( string $content, string $mime_type ) : File Upload file from string using mime-type.
fromPath ( string $path, string | boolean $mime_type = false ) : File Upload file from local path.
fromResource ( resource $fp ) : File Upload file from file pointer
fromUrl ( string $url, boolean $check_status = true, integer $timeout = 1, integer $max_attempts = 5 ) : File | string Upload file from url and get File instance
status ( string $token ) : object Check file status.

Приватные методы

Метод Описание
__initRequest ( $type, array $data = null ) : resource Init upload request and return curl resource
__runRequest ( $ch ) : object Run prepared curl request.
__setData ( $ch, array $data = [] ) : void Set data to be posted on request
__setHeaders ( $ch ) : void Set all the headers for request and set return transfer.
__setRequestType ( resource $ch ) : void Set request type for curl resource

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

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

Constructor
public __construct ( Api $api )
$api Api

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

Create group from array of File objects
public createGroup ( array $files ) : uploadcare\Group
$files array
Результат uploadcare\Group

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

Upload file from string using mime-type.
public fromContent ( string $content, string $mime_type ) : File
$content string
$mime_type string
Результат File

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

Upload file from local path.
public fromPath ( string $path, string | boolean $mime_type = false ) : File
$path string
$mime_type string | boolean
Результат File

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

Upload file from file pointer
public fromResource ( resource $fp ) : File
$fp resource
Результат File

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

Upload file from url and get File instance
public fromUrl ( string $url, boolean $check_status = true, integer $timeout = 1, integer $max_attempts = 5 ) : File | string
$url string An url of file to be uploaded.
$check_status boolean Wait till upload is complete
$timeout integer Wait $timeout seconds between status checks
$max_attempts integer Check status no more than $max_attempts times
Результат File | string

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

Return array of json data
public status ( string $token ) : object
$token string
Результат object