QuickBlox Documentation

QuickBlox provides powerful Chat API and SDK to add real-time messaging and video calls to your web and mobile apps. Learn how to integrate QuickBlox across multiple platforms.

Content

Learn how to store and access files with QuickBlox file storage.

🚧

This is our documentation for beta version of QuickBlox React Native SDK. Please contact our Customer Support Team to provide your feedback, suggestions, and requests to improve this page.

The content module allows storing rich chat attachments, app content, and settings without having to republish them. Using a web interface you or your clients can control and make instant changes to the apps.

Before you begin

  1. Visit our Key Concepts page to get an overall understanding of the most important QuickBlox concepts.
  2. Register a QuickBlox account. This is a matter of a few minutes and you will be able to use this account to build your apps.
  3. Configure QuickBlox SDK for your app. Check out our Setup page for more details.
  4. Create a user session to be able to use QuickBlox functionality. See our Authentication page to learn how to do it.

Upload file

Upload a file to the cloud using the following code snippet.

const url = 'path to file in local filesystem'
QB.content
  .upload({ url, public: false })
  .then(function (file) { /* file uploaded successfully */ })
  .catch(function (e) { /* handle error */ })

The maximum size of the uploaded file depends on the membership plan.

Basic

Startup

Growth

HIPAA

Enterprise

File size limit

10 Mb

25 Mb

50Mb

50Mb

Contact our sales team

Get file info

Get information about a file by ID using the getInfo() method below. This method allows to load the file description model from the server, not the content of the file itself.

QB.content
  .getInfo(params: { id: 1234567 })
  .then((file) => {
    // process result
  })
  .catch(e => {
    // handle error
  })

Argument

Required

Description

id

yes

ID of the file.

Get file URL

There are two types of file URLs that can be obtained: private and public.

  • Public URL allows anyone to access the file, no authorization token is needed.
  • Private URL can be accessed only by QuickBlox user with a session token.

Get public URL

To receive a public URL, use the code snippet below.

QB.content
  .getPublicUrl({ uid: 'file uid' })
  .then(function (url) { /* handle as necessary */ })
  .catch(function (e) { /* handle error */ })

Get private URL

To get a private URL of the uploaded file, use the following code snippet.

QB.content
  .getPrivateURL({ uid: 'file uid' })
  .then(function (url) { /* handle as necessary */ })
  .catch(function (e) { /* handle error */ })

Update upload status

Subscribe to content module events to update file upload status.

export function* uploadFile(action = {}) {
  const { url } = action.payload
  try {
    yield call(QB.content.subscribeUploadProgress, { url })
    const file = yield call(QB.content.upload, { url, public: false })
    yield put(fileUploadSucess(file))
  } catch (e) {
    yield put(fileUploadFail(e.message))
  } finally {
    yield call(QB.content.unsubscribeUploadProgress, { url })
  }
}

Updated 7 days ago



Content


Learn how to store and access files with QuickBlox file storage.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.