Flower Docs
  • OpenFlower overview
    • The "Hello World" tutorial
  • Videos
    • OpenFlower in 100 seconds
  • 🆕Setup and run
    • Cloud & Private Cloud
    • Self-hosting
      • Access local database or API
      • Google Cloud Platform
      • Heroku
      • Migration from Openblocks
      • Update MongoDB Versions
      • OpenFlower Version Update
      • Traefik loadbalancer
      • SMTP Server
    • Security
  • 🏨Workspaces & Teamwork
    • Workspaces
    • Members and Groups
    • Permissions for Resources
    • OAuth
      • KeyCloak
      • Google
      • GitHub
      • Generic OAuth Provider
    • Query library
    • OpenFlower Marketplace
  • ✨Build Applications
    • Create a new App
      • Modules
      • Version and Release Management
    • App Editor
      • Visual Components
        • Common Component Settings
        • File upload
        • Charts and graphs
        • Image
        • Option lists
        • List View
        • Drawer
        • Google Maps
        • Table
        • Messages / Toast
        • Calendar
      • Date handling
      • Bulk Editing
      • Layers
      • Data selection & Javascript
      • Use Markdown
      • Keyboard shortcuts
    • App Navigation
    • App Interaction
      • Event handlers
    • Themes & Styling
      • Design an efficient and user-friendly form
      • Customize Styles
      • Component Styling Possibilities
  • 🚀Connect your Data
    • Data source basics
    • Data sources in OpenFlower
      • APIs as Datasource
        • REST API
        • GraphQL
        • Google Sheets
      • SQL Databases
        • MySQL
        • MariaDB
        • PostgreSQL
        • Microsoft SQL Server
        • Oracle
      • NoSQL Databases
        • MongoDB
        • CouchDB
        • DynamoDB
      • InMemory Databases
        • Redis
      • File Storages
        • S3 File Storage
      • BigData & OLAP
        • Big Query
        • Snowflake
        • ClickHouse
        • Elasticsearch
      • Websocket Datasource
    • Query basics
      • Bind Query Data to Components
      • Query library
  • 🪄Workflows
    • n8n Integration
  • 💫Business Logic in Apps
    • Write JavaScript
      • JavaScript query
      • Temporary state
      • Transformers
      • Data responder
      • Built-in JS functions
  • 🙌Publish Apps
    • Share an App
    • Publish an App
    • Embedd an App
      • Embed Apps in React
      • Native embed SDK
        • Build the SDK from Source
  • 🔥OpenFlower Extension
    • Opensource Contribution
      • Develop UI components for Apps
      • Develop Data Source Plugins
    • Use third-party libraries in Apps
      • Day.js Date handling
      • Import your own JavaScript Library
    • Custom component
    • OpenFlower Open REST API
Powered by GitBook
On this page
  • Basics
  • File type
  • Upload type
  • Display uploaded files
  • Parse files
  • Validation
  • Max files
  • File size
  • Access uploaded files
  1. Build Applications
  2. App Editor
  3. Visual Components

File upload

PreviousCommon Component SettingsNextCharts and graphs

Last updated 7 months ago

Basics

The File upload helps you to able users to upload binary and text Files and process this data further in OpenFlower to send it to local or remote Storage and other Backends.

File type

  • A valid case-insensitive filename extension, starting with a period character ("."), such as .png, .txt, and .pdf.

  • String audio/* indicating "any audio file".

  • String video/* indicating "any video file".

  • String image/* indicating "any image file".

For example, when the value of file type is [".pdf", ".mp4", "image/*"], you can upload PDF files, MP4 files, and any type of image files.

Upload type

You can decide whether to upload a single file, multiple files, or a directory.

Display uploaded files

Switch on or off Show upload list to display or hide the list of the uploaded files. You can also set this property via JS code. By default, its value is "true".

The upload list presents the file names of all uploaded files in chronological order. You can also access the name of the uploaded files via the property files[index].name. When hovering your mouse over a file, the 🗑️ icon appears and you can click it to delete the corresponding file.

Parse files

Toggle Parse files and OpenFlower will try to parse the uploaded file data structure into objects, arrays, or strings. This does not work with binary data but with structured text data like Excel, JSON, and CSV files.

You can access the parsed result via the property parsedValue.

For each uploaded file OpenFlower will try to parse and you can access the data of the files then in the array.

// access the structured content of an uploaded File in OpenFlower Apps
file1.parsedValue[0]
// the array contains the data for each uploaded file.
file1.parsedValue[0], file1.parsedValue[1], file1.parsedValue[2]

Validation

Under the validation tab, you can configure how many files are allowed to be uploaded, as well as the minimum and maximum size of a single file to be uploaded.

Max files

When the upload type is "Multiple" or "Directory", you can set Max files to limit the maximum number of files to upload. If the number of files to be uploaded exceeds this threshold, the latest uploaded files will replace the oldest ones.

File size

You can set the minimum and maximum size of the files to upload, using KB, MB, GB, or TB units. The default unit for file size is byte. When the size of the uploaded file exceeds the limit, you will see a global alert.

Access uploaded files

Files uploaded via the file upload component are stored in browser cache memory in base64-encoded string format. To store these files in data sources, you need to build queries to connect to databases or APIs. You can view the properties of the uploaded files in the data browser in the left pane, or access property names in {{}} or JS queries via JS code. Commonly used properties are as follows.

  • value: A list of the content of the uploaded files, encoded in base64.

// Access the File content (represented as base64)
{{file1.value[0]}} // will return "WwogIHsKICAgICJpZCI6ICJkODE5NGI3Mi1lZGNiLTRhMWMtYTRlMC1lZT...
  • files: A list of metadata of the uploaded files, including uid, name, type, size, and lastModified.

// Access the File metadata information. 

{{file1.files[0].name}} // will return "open_issues.json"

{{file1.files[0].type}} // will return "application/json"

{{file1.files[0].type}} // will return "247285" (in bytes)
  • parsedValue: A list of the value of the parsed files.

You can input an array of strings to restrict the types of the files to be uploaded. The default value of file type is empty, meaning that no limitation is pre-defined. Each string value in a specified file type array should be a in one of the following formats.

A valid string in without an extension.

✨
unique file type specifier
MIME format
File Upload Component
Configure the File Upload to accept individual, multiple Files or whole Folders
OpenFlower can try to parse the content of the files so you can directly access it.
You can access the contents of Excel, CSV and JSON Files as JSON Data object after upload and parse
You can define the minimal and maximal size of files that can get uploaded
If multiple files can get uploaded, you can define the maximal amount of files