Appendix B: Managing files

Don't forget to check out our JSON RESTful APIs, they can help you utilize and extend Quickbase with ease.

 

Quickbase applications can support file attachment storage and file attachment access through the API’s file upload and download feature. Files are “attached” through a record field that has the type File Attachment.

File attachments are stored in a special database that is separate from the Quickbase application database. That means they won’t take up space in the Quickbase application database.

This section describes the typical upload scenario where access to the local file system is available if needed. If your environment cannot make use of the local file system, you may need to use the API_UploadFile call.

Uploading files

Files are uploaded as file attachments to a record during an API_AddRecord or API_EditRecord call. The file field you use for file attachments must be of type File Attachment.

The file must be base64-encoded. You should not use MIME style encoding with newline characters at a maximum line length of 76. Instead, Quickbase requires you omit these newlines. (If you don’t omit the newlines, the stored file in Quickbase won’t be usable.)

Because of the typical file sizes, you won’t be able to upload files using a URL. You must POST the encoded file as XML.

Downloading files

You can download a file in two ways:

  • If you know the database ID, the record ID, the Field ID of the file field you are attaching to, and the version ID, you can use issue a GET request using this URL format:

    https://target_domain.quickbase.com/up/DBID/a/rRID/eFID/vVID

    where:

    • target_domain is the domain against which you are invoking this call, for example, quickbase.com. Read about this notation.

    • DBID is your table dbid (not the application dbid)

    • RID is the record ID of the record with the file attachment

    • FID is the field ID of the file attachment field

    • VID is the version ID of the file. Specifying 0 (zero) for the VID always gets you the most recent version.

    For example: https://quickbase.com/up/bdb5rjd6h/a/r13/e8/v0

  • If you know the URL of the file attachment, you can issue a GET request that contains the URL of the file attachment and the table dbid. (To get the URL, use API_DoQuery if and set its fmt parameter to “structured.” The URL is returned in the <url></url> tags.)

    Here’s a typical URL that you would use in this second way of doing a GET:

    https://target_domain.quickbase.com/up/bdb5rjd6g/g/rz/ey/va/Model_T.jpg

Note: If you use file attachments, you should understand how Quickbase versions files. See the Quickbase online help for more information.