Skip to main content
Version: 5.7.0

PrepareUserUpload - CloudCode and JavaScript

Prepares a user file upload. On success an uploadId will be returned which can be used to upload the file using the _bc.file.uploadFile method.

ServiceOperation
filePREPARE_USER_UPLOAD

Method Parameters

ParameterDescription
cloudPathThe desired cloud path of the file
cloudFilenameThe desired cloud fileName of the file
shareableTrue if the file is shareable
replaceIfExistsWhether to replace file if it exists
fileSizeThe size of the file in bytes
localPathThe path and fileName of the local file

Usage

http://localhost:3000
// N/A
JSON Response
{
"status":200,
"data":{
"fileDetails":{
"updatedAt":1452616408147,
"fileSize":100,
"fileType":"User",
"expiresAt":1452702808146,
"shareable":true,
"uploadId":"cf9a075c-587e-4bd1-af0b-eab1a79b958f",
"createdAt":1452616408147,
"profileId":"bf8a1433-62d2-448e-b396-f3dbffff44",
"gameId":"99999",
"path":"dir1/dir2",
"filename":"filename",
"replaceIfExists":true,
"cloudPath":"bc/g/99999/u/bf8a1433-62d2-448e-b396-f3dbffff44/f/dir1/dir2/filename"
}
}
}
Common Error Code

Status Codes

CodeNameDescription
40429UPLOAD_FILE_TOO_LARGEFile maximum file size exceeded
40430FILE_ALREADY_EXISTSFile exists, replaceIfExists not set