Amazon S3 Basic
We have an automated setup process to configure your application to work with Amazon S3 Basic. This page provides the information you need to set up additional tables in your application to use Amazon S3 Basic, if desired.
To set up your Quickbase application to work with the Amazon S3 Basic utility, you need to do the following:
Add nine (9) fields to your Quickbase table for each file that you want to store in Amazon S3 and link back to your Quickbase record. Field names do not matter, so you can name them however you like. The field types are important, so you must follow the types specified here.
Form view

1. Upload—this field executes the Amazon S3 tool, allowing you to upload a file from your local network to your Amazon S3 bucket.
Field Type: formula URL
Display Text: type in Upload File
Options: select Display as a button
Formula:
"javascript:void(window.open('" &
"https://www.quickbaseutilities.com/XXXXXX/AmazonS3/upload.aspx?"
& "clientid=Q123"
& "&appid=bbbbbbbbb"
& "&fn=" & URLEncode ([Custom S3 Key])
&"&dbid=" & Dbid()
&"&rid=" & URLEncode ([Record ID#])
&"&fnfid=6"
& "&fsfid=7"
& "&uffid=8"
& "&keyfid=9"
& "&bkt=yyyyyyyyyy" 'optional
& "&sakey=" & [vvvvvv] 'optional
&"&apptoken=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" 'optional
& "','copy','top=240,left=320,width=575,height=195,location=no,menubar=no,toolbar=no,status=yes'))"The value from the &fn parameter in the upload field is used as the "key" value stored in Amazon S3. It is stored in the S3 Key field after the file is successfully uploaded to Amazon S3.
The Custom S3 Key formula field is used to generate a key value to link the file to the Quickbase record. This field was introduced in later versions of Amazon S3 Basic to help create a more complex key for increased security. This formula field can be modified, if desired, to create a custom algorithm for generating S3 keys. We suggest making the key recreatable based on some data on the record.
2. Download—this field executes the Amazon S3 tool, allowing you to download a file from your Amazon S3 bucket that's linked to your Quickbase record.
Field Type: formula URL
Display Text: type in Download File
Options: select Display as a button
Formula:
var text url = "https://www.quickbaseutilities.com/XXXXXX/AmazonS3/download.aspx?"
& "clientid=Q123"
& "&appid=bbbbbbbbb"
& "&fn=" & URLEncode ([S3 Key])
&"&psu=n"
& "&bkt=yyyyyyyyyy" 'optional
& "&sakey=" & [vvvvvv] 'optional
&"&apptoken=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" 'optional
;
If ([File Uploaded],$url,"")3. Delete—this field executes the Amazon S3 tool, allowing you to delete a file from your Amazon S3 bucket that's linked to your Quickbase record. The Quickbase record itself isn't deleted—only the linked file in your Amazon S3 bucket is deleted.
Field Type: formula URL
Display Text: type in Delete File
Options: select Display as a button
Formula:
var text url = "javascript:void(window.open('" &
"https://www.quickbaseutilities.com/XXXXXX/AmazonS3/delete.aspx?"
& "clientid=Q123"
& "&appid=bbbbbbbbb"
& "&fn=" & URLEncode ([S3 Key])
&"&dbid=" & Dbid()
&"&rid=" & URLEncode ([Record ID#])
&"&fnfid=6"
& "&fsfid=7"
& "&uffid=8"
& "&keyfid=9"
& "&bkt=yyyyyyyyy" 'optional
& "&sakey=" & [vvvvvv] 'optional
&"&apptoken=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz" 'optional
& "','copy','top=240,left=320,width=575,height=195,location=no,menubar=no,toolbar=no,status=yes'))";
If ([File Uploaded],$url,"")4. File Name—this field stores the name of the file in your Quickbase record.
Field Type: Text
5. File Size—this field stores the size of the file in bytes. You can use it to calculate the amount of space you're consuming in your Amazon S3 bucket.
Field Type: Numeric
6. File Uploaded—this field indicates whether a file has been uploaded to Amazon S3. It's used to show or hide the Download and Delete formula fields. If there is no file uploaded, the Download and Delete fields are set to blank.
Field Type: Checkbox
7. S3 Key—this field stores the key to the file in Amazon S3. This is the link between your Quickbase record and Amazon S3. The value in this field is created by the Upload process—the fn parameter in the Upload formula URL field determines this value. This field is used in the Download and Delete formula fields to access the file in Amazon S3.
Field Type: Text
8. Download Link—this field references the Download field and provides another way for users to download the file from Amazon S3. It shows the link with the value from the File Name field.
Field Type: Formula-Text
Allow some HTML: checked
Formula:
"<a href=\""& [Download]
& "\">" &[File Name] & "</a>"9. Custom S3 Key—this field helps generate a random, unique key value that's stored in Amazon S3 and also in the S3 Key field described earlier.
Field Type: Formula-Text
Notes
Within the formula URL fields, we've identified some variables that need to be set for the tool to function properly. The following defines these variables:
"XXXXXX"—this value is provided to you by Quickbase Extensions and represents your instance on our web server.
"12"—these are the field ID# values for the fields created in the setup process. You can find the field ID# values in the following screenshot. These vary per Quickbase table.
"bbbbbbbbb"—this value is a unique identifier for your Quickbase application, your application ID. Each application that uses our tool must be registered with us to function. You can find this value from the Help menu when you're signed into your Quickbase application.


"yyyyyyyyy"—this is the bucket name parameter, and it's optional. We set up a default bucket name for you on our web server. This parameter is only necessary if you want to vary the bucket or use different buckets for different reasons. If you use only one S3 bucket, you can omit this parameter.
"zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"—this is the application token parameter. It's required if you have the Application Tokens security feature turned on in your application. If you don't have tokens turned on, you can omit this parameter.
"vvvvv"—this is the name of the application variable that stores the Amazon S3 secret access key. If you want to pass this key into our tool, we suggest creating an application variable and maintaining the secret access key there. If the key isn't being passed in, you can omit this parameter.
Important
Storing more than one file per record
If you plan on storing more than one file per record in the same table, you need to:
Create a set of 9 fields for each file. When doing this, we typically include a prefix in each field name so it's easy to know which fields are grouped together. You can always change the labels on the form, but for demo purposes, they're left unchanged in the following screenshot.
You also need to include a suffix in the Custom S3 Key field formula for each file in the same table—otherwise, they would overwrite each other.
Dbid() & "_" & [Record ID#] & "_xxx_" & ...

