Introduction

Getting started

Walkthrough Guides

CafeX Apps

Workflows

Using CafeX Collaborate App

Reporting

Managing CafeX

Integrating CafeX

Security

App Studio

App Studio Components

App Studio Components

Managing File Upload Component

Modified on Wed, 22 Jan at 8:48 AM

TABLE OF CONTENTS


The File upload Component allows users to upload files directly within the App.


Appearance Settings


The File upload Component includes standard appearance settings, such as size and position, visibility, background, text, padding, margin, border, drop shadow (for details on standard appearance settings, check the Altering the appearance of an App Studio Component article).


Configuration Settings


The following settings are available for the File upload Component:

SettingDescription
Custom Image as an IconProvide an image URL or choose an image to use as an icon.
Primary textAdd the main text displayed to users.
Secondary textProvide the additional text, such as guidelines or restrictions for uploads.
Button textDefine the label for the upload button.
Allowed file typesSpecify the types of files users can upload.
Max file sizeSpecify the maximum file size that can be uploaded and select a unit (KB or MB).
Output as data URLToggle this setting to determine how the uploaded file’s content is returned in the output array.
Disabled: Returns Base64-encoded data in the contentfield.
Enabled: Returns a Data URI in the content field (e.g., data:image/png;base64,).
Tooltip textProvide a tooltip to give users additional information when they hover over the Component.
Event handlersAdd new even handlers or manage the existing ones. For details on event handlers, check Using Event Handlers.


Example: Profile Picture Uploader


To illustrate the setup of a File upload Component, let’s create a Profile Picture Uploader.


Step 1: Configure the File Upload Component


To configure the File Upload Component:

  1. Add the File upload Component onto the canvas. If necessary, rename it.
  2. Set the Configuration:
    Custom image as an iconUse an image URL of a camera icon.
    Primary textEnter Upload Your Profile Picture.
    Secondary textAdd Maximum size: 2 MB. Accepted formats: .jpg, .png.
    Button textSet to Choose File.
    Allowed file typesSpecify .jpg, .png.
    Max file sizeSet to 2 MB.
    Output as Data URLEnable this option if you need the image data encoded as a data URL.
    Tooltip textEnter Click to upload your profile picture.
    Event HandlersOptionally, you can add an event handler that will navigate the user to the Profile Settings tab to complete their profile once the picture is selected. The event handler should have the following properties: Handler name: Navigate to Profile Settings, Event type: File selected, Action: Select a tab.
  3. Customize the Appearance:

    SettingDescription
    Size and PositionDefine size and position settings.
    BackgroundSet the background color to the desired color, for example, #FFFFFF.
    TextSet the color to the desired color, for example, #333333.
    PaddingAdd 10px of padding to ensure spacing inside the Component.
    BorderUse a 2px solid border with rounded corners (5px) and color #CCCCCC.
    Drop ShadowAdd a shadow with color #C4C4C4 and a blur radius of 5px.


The screenshot below shows the File Upload Component configured for a profile picture upload.


Step 2: Create a Data Set for the Uploaded Image

  1. In the App Studio, go to App > Data Sets
  2. Click Add data set and configure it as follows:
    NameuploadedImage
    TypeVariable
    Expression{{{FileUpload.selected:last.content}}}
    Where:
    FileUpload matches the name of your File Upload Component.
    :last.content retrieves the most recently uploaded file's content.
  3. Click Add.

This Data Set will store the content of the last uploaded image.


Step 3: Add and Configure an Image Component

  1. Add an Image Component to your interface.
  2. In the Configuration tab of the Image Component, locate the Data set setting and select the uploadedImage data set you created previously.


Step 4: Test the Profile Picture Uploader

  1. Upload an image file using the File Upload Component.
  2. The uploaded image will be displayed in the Image Component.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article