Skip to main content
Version: 5.7.0

File

The File API allows brainCloud users to upload files to their individual accounts. These files can be private to the user, or shareable (public) where anyone with the URL can access the file.

Downloading Files

Downloading files is usually as simple as getting the file URL via the ListUserFiles API and downloading it via whatever method you decide on the platform you are working on. The brainCloud client does not have built in support for downloading files.

tip

Pro-tip: There are two URLs for file downloading, downloadUrl and cdnUrl, in our file system.

  • The downloadUrl is a persistant URL that automatically redirects to a CDN URL (if enabled) when called
  • The cdnUrl is a temporary URL that is good for downloading the file right away (in an hour from the time to generate that URL)

Apps do not have to specifically retrieve the CDN urls of files. brainCloud will automatically redirect the client to the CDN address when a download attempt is made.

Shared Files

If the file you are downloading is shared publically (shareable = true) by the owner then there are no special steps required to download. Simply get the file URL and download.

Private Files

If the file you want to download is private, and therefor only accessible by the owner there is another step to successfully downloading the file. To ensure that the person downloading the file is the owner you must append an active Session ID from the file owner to the file URL as a query parameter.

To get the session ID simply call the GetSessionId method of the BrainCloudClient. Here is an example URL with the Session ID appended:

https://api.braincloudservers.com/downloader/bc/g/123465/u/fe32f00f-9eda-4047-83b1-120b3398b14b/f/TestFile.dat?sessionId=l92dmkua0aqvb4egtid3fn14n7

API Summary

Managing Uploads

Monitoring Uploads

File Management

JavaScript Methods

Unity Methods