API Reference

Media.createMultiPartUpload

Begin a multi part upload with a call to this method, it will return an ID that will need to be used by either completeMultiPartUpload or abortMultiPartUpload.

Note:Minimum chunk size is 5M


Syntax

ARRAY/ media.createMultiPartUpload ( INT vhost, STRING filename, STRING contentType, ARRAY partInfo, ARRAY fileData = array(), INT timeOut = 6000, mixed setAvatar = false )

Arguments

NameTypeRequiredDefault valueDescription
vhostINTRequirednoneThe vhost ID.
filenameSTRINGRequirednoneOriginal filename of the file being uploaded, including the extension.
contentTypeSTRINGRequirednoneThe content type of the file being uploaded eg. image/jpeg
partInfoARRAYRequirednoneAn array containing the chunk number as the index, and the chunk filesize in bytes as the value. eg partInfo[1]=5242880
fileDataARRAYOptionalarray() An array containing additional information about the file, such as title, message, metadata.
timeOutINTOptional6000The amount of time in minutes each signed URL will be valid for, after this time limit the URL will no longer work.
setAvatarmixedOptionalfalse

Response

A reason for failure will be returned otherwise you'll receive an ID representing the media, and a partUrls array.

NameTypeDescriptionDefault Values
idINTWill contain the media ID of the new upload, this should be used throughout the upload processmedia id
partUrlsARRAYA list containing 'url' and 'part', for each part provided in the partInfo array, part being the index number of a certain chunk.[url]/[part]
statusBOOLWill return false, if there is a failure, otherwise true. boolean
causeSTRINGWill only return in the event of a failure with the reason. string

fileData Array

The fileData array may contain the following parameters.

NameTypeDescriptionDefault Values
titleSTRINGThe title of the media item being uploaded..none
messageSTRINGThe description of the media item being uploaded.none
metaARRAYUse this to include additional custom information about the file when uploaded.none
uidINTThe ID of the user who is uploading the media.If not provided it will default to anonymous user(1)
channelINT The channel ID of the media item is going to be uploaded into.none
parentidINTThe media id that you'd like to be the parent of this media.none
tagsSTRINGA set of words used to tag the media item. Tags are searchable in our system. Each tag is separated by a space — for example "upload media torontoweather toronto".none

Sample Response

Code examples

0 comments

Be the first to comment on createMultiPartUpload.

Add a Comment

  • captcha