Files Blocks
Last updated
Last updated
Advanced Blocks
For most blocks 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.
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.
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 |
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.
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 |
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.
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.
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.
Advanced Block
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 some examples of the url from uploaded file
block in action, check out this video tutorial: How to Create Data in a Thunkable Data Source and the following screenshots.
Connect the image from photo library
block to the url from uploaded file
block to allow users to browse and select any image stored on their device's library.
Connect the photo from camera
block to the url from uploaded file
block to let users snap a picture from their device's camera and upload it instantly.
Connect the image file from device
block to the url from uploaded file
block for a more universal option that works on Android, iOS, and even in web apps, allowing users to upload any image file from their device, no matter the platform.
This block will take an image file and return it in the given dimensions, quality and format.
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 |
The Download File within app blocks enable your app's users to download files used in your app on request, ensuring a better offline user experience.
This block allows you to download a file from a URL onto your device. This file cannot be accessed from outside the app.
Advanced Block
Output | Data Type | Function |
---|---|---|
file | Text | Returns a file name and extension for the downloaded file. |
progress | number | Returns the progress of the downloaded file. |
error | Text | If there was an error, returns the error. Else returns NULL |
The file type in the URL must be the same type as the type on the file name. Downloaded files cannot be accessed outside of the app (e.g. device files, photo gallery, etc.).
This block returns the list of files that you have already downloaded.
Advanced Block
Output | Data Type | Function |
---|---|---|
files | Text | Returns a list of file names and extensions for the downloaded files. |
error | Text | If there was an error, returns the error. Else returns NULL |
This block deletes the file that you have downloaded from your local storage.
Advanced Block
Output | Data Type | Function |
---|---|---|
error | Text | If there was an error, returns the error. Else returns NULL |
This block renames a previously downloaded file from your local storage.
Advanced Block
Output | Data Type | Function |
---|---|---|
error | Text | If there was an error, returns the error. Else returns NULL |
Click the Settings icon in the left side menu.
Input your Cloudinary Cloud Name, API Key, and API Secret.