PHP 클래스 Uploadcare\Uploader

파일 보기 프로젝트 열기: uploadcare/uploadcare-php

공개 메소드들

메소드 설명
__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