Files Blocks
Advanced Blocks
For each block in this drawer, you can right-click the block and select Show advanced block to see an expanded block with additional outputs. Both the simple and advanced blocks will be explained in this document.
Image/Video from Photo Library
This block will open the user's photo library and allow the user to select a photo or video. The file can then be used in the app.
Advanced Block
Output | Data Type | Function |
---|---|---|
photo or video | image/video | if a file was selected, returns the file |
was cancelled | true/false | returns whether the user cancelled selecting a file |
error | text | if there was an error, returns the error |
File from Device
This block will open the user's file library and allow the user to select a file. The file can then be used in the app.
You can allow the user to upload any kind of file, or limit their selection by file type using the drop down menu.
Your end users may experience lags or delays if the file size they try to upload is larger than 5MB.
Advanced Block
Output | Description | Data Type |
---|---|---|
file | Points to the file that has been uploaded | Data type of the file that has been uploaded. Can also return address of the file as text |
name | Name of the uploaded file | Text |
mime type | Describes the type of file in MIME format | Text |
size | Returns size of uploaded file in bytes | Number |
was cancelled | Indicates whether the end user cancelled selecting a file | True/False |
error | If there is an error, returns the error. Else returns | Text |
Upload a File to the Cloud
Thunkable integrates with Cloudinary, a service that allows you to store media files in the cloud. The upload file block allows you to send media directly from your Thunkable app to a linked Cloudinary account.
Video Tutorial
How to Store and Access Cloudinary Files in Your Thunkable App
In this tutorial, you’ll learn how to use files stored in Cloudinary in your app and how to upload files directly from your app to Cloudinary.
Connect Your Cloudinary Account to Your Thunkable Project
Thunkable provides a shared Cloudinary account for your convenience, but we strongly recommend creating your own account to ensure privacy for your uploaded media. In addition, the shared Thunkable Cloudinary account has a media size limit of 10MB per app and your files will be deleted after 90 days.
To connect your Cloudinary accout to your Thunkable project:
Create a free Cloudinary account here: cloudinary.com.
From your Cloudinary dashboard, retrieve the following account details:
Cloud Name
API Key
API Secret
Return to your Thunkable project page.
Scroll down until you reach the Cloudinary Settings section.
Block: url from uploaded file / upload file
To access the url from uploaded file
or upload file
block:
Navigate to your project's Blocks tab.
Under the App Features heading, click Files.
Output | Data Type | Function |
---|---|---|
URL | text | returns a URL for the uploaded file |
error | text | if there was an error, returns the error |
To see an example of the url from uploaded file
block in action, check out this video tutorial: How to Create Data in a Thunkable Data Source.
Resize Image
This block will take an image file and return it in the given dimensions, quality and format.
Advanced Block
Input | Data Type | Function |
---|---|---|
resize image | Any image file | The image to be resized |
width | Number | Width in pixels to resize image file to |
height | Number | Height in pixels to resize image file to |
quality | Number | Quality of resulting image, as a percentage of quality of original image |
using ... format | Select from menu | Select image type for resulting image |
Output | Data Type | Function |
---|---|---|
resized Image | Image | The resized image in the selected format and quality level |
error | Text | If there was an error, returns the error. Else returns NULL |
Last updated