Userbase

Docs : SDK : uploadFile

uploadFile lets you upload files to a database. The file gets attached to an item, so you must create an item first via insertItem to upload a file. This API will return a promise that gets resolved once the file has been durably stored.

    
      userbase.uploadFile({
        databaseName: 'example-database-name',
        itemId: 'example-id',
        file: new File(['example'], 'example.txt', { type: 'text/plain' }),
        progressHandler: ({ bytesTransferred }) => {
          // Display progress using bytesTransferred / file's size
        }
      }).then(() => {
        // file stored durably
      }).catch((e) => console.error(e))
  

Parameters

Advanced Parameters

Errors