ParseFile

Implements \Parse\Internal\Encodable

Class ParseFile - Representation of a Parse File object.

author

Fosco Marotto fjm@fb.com

package

Parse

Methods

Internal method used when constructing a Parse File from Parse.

_createFromServer( $name,  $url) : \Parse\ParseFile
static

Arguments

$name

$url

Response

\Parse\ParseFile

Encode to associative array representation.

_encode() : array

Response

array

Create a Parse File from data i.e. $file = ParseFile::createFromData('hello world!', 'hi.txt');.

createFromData(mixed $contents, string $name, string $mimeType = null) : \Parse\ParseFile
static

Arguments

$contents

mixed

The file contents

$name

string

The file name on Parse, can be used to detect mimeType

$mimeType

string

Optional, The mime-type to use when saving the file

Response

\Parse\ParseFile

Create a Parse File from the contents of a local file i.e. $file = ParseFile::createFromFile('/tmp/foo.bar', 'foo.bar');.

createFromFile(string $path, string $name, string $mimeType = null) : \Parse\ParseFile
static

Arguments

$path

string

Path to local file

$name

string

Filename to use on Parse, can be used to detect mimeType

$mimeType

string

Optional, The mime-type to use when saving the file

Response

\Parse\ParseFile

Send a REST request to delete the ParseFile.

delete(boolean $useMasterKey = true) 
Throws
\Parse\ParseException

Arguments

$useMasterKey

boolean

Whether to use the Master Key.

Attempts to download and return the contents of a ParseFile's url

download() : mixed
Throws
\Parse\ParseException

Response

mixed

Return the data for the file, downloading it if not already present.

getData() : mixed
Throws
\Parse\ParseException

Response

mixed

Return the mimeType for the file, if set.

getMimeType() : string|null

Response

string|null

Returns the mimetype for a given extension

getMimeTypeForExtension(string $extension) : string

Arguments

$extension

string

Extension to return type for

Response

string

Return the name for the file Upon saving to Parse, the name will change to a unique identifier.

getName() : string

Response

string

Return the URL for the file, if saved.

getURL() : string|null

Response

string|null

Uploads the file contents to Parse, if not saved.

save(boolean $useMasterKey = false) : boolean

Arguments

$useMasterKey

boolean

Whether to use the Master Key.

Response

boolean

Internally uploads the contents of the file to a Parse Server

upload(boolean $useMasterKey = false) : mixed
Throws
\Parse\ParseException

Arguments

$useMasterKey

boolean

Whether to use the Master Key.

Response

mixed

Result from Parse API Call.

Properties

The filename.

name : string
var

Type(s)

string

The URL of file data stored on Parse.

url : string
var

Type(s)

string

The data.

data : string
var

Type(s)

string

The mime type.

mimeType : string
var

Type(s)

string