Appendix B: Managing Files

Quick Base 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 Quick Base application database. That means they won’t take up space in the Quick Base 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, Quick Base requires you omit these newlines. (If you don’t omit the newlines, the stored file in Quick Base 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 rid of the record with the File attachment

    • FID is the fid 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 Quick Base versions files. See the Quick Base online help for more information.

 

Go back

Did this help you? Give us a rating:

           

© 1999-2019 QuickBase, Inc. All rights reserved. Legal Notices.