mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-22 22:17:55 +00:00
* add app-builder doc updates on Table and themes * breakdown chart docs in two parts and add custom css for headers * update chart example images and add more examples * revamp table component and minor fixes * fix typos * fix table formatting for docusarus v3 * fix filepicker table * create new version * fix grammar and tables
3 KiB
3 KiB
| id | title |
|---|---|
| upload-files-gcs | Upload Files Using GCS |
In this guide, we are going to create an interface to upload PDFs to Google Cloud Storage.
Before adding the new data source we will need to have a private key for our GCS bucket and make sure the key has the appropriate rights.
Setting up Google Cloud Storage Data Source
- Go to the data source manager on the left-sidebar and click on the
+button. - Add a new GCS data source from the APIs section in modal that pops up.
- Enter the JSON private key for service account and test the connection.
- Click on Save to add the data source.
Adding a File Picker
- Drag and drop the file picker widget on the canvas
- Configure the file picker:
- Change the Accept file types to
{{"application/pdf"}}for the picker to accept only pdf files. In the screenshot below, we have set the accepted file type property to{{"application/pdf"}}so it will allow to select only pdf files:
- Change the Max file count to
{{1}}as we are only going to upload 1 file at a time.
- Select a pdf file and hold it in the file picker.
:::info File types must be valid MIME type according to input element specification or a valid file extension.
To accept any/all file type(s), set Accept file types to an empty value.
:::
Creating a Query
- Click on the
+button of the query manager at the bottom panel of the editor and select the GCS data source - Select Upload file operation and enter the required parameters:
- Bucket:
gs://test-1 - File Name:
{{components.file1.file[0]['name']}} - Content Type:
{{components.file1.file[0]['type']}} - Upload data:
{{components.file1.file[0]['base64Data']}} - Encoding:
base64
- Click on Save to create the query
Running the Query
- Add a button that will fire the query to upload the file
- Edit the properties of the button and add a event handler to Run the query on On-Click event.
- Click on Button to fire the query, this will upload the pdf file that you selected earlier through the file picker and will upload it on the GCS.



