Skip to end of metadata
Go to start of metadata



General

Component Palette Icon:



Description

The File Upload component allows users to upload files to the Gateway from a Perspective session. These files can be handled and saved via a script action on the onFileReceived component event.

The component has three different appearances based on its width: at its smallest, the component appears as a simple "Cloud" icon, and converts to a "Browse" button at larger widths.

Properties

Most Properties have binding options. For more information on Bindings, see Types of Bindings in Perspective.
This section only documents the Props Category of properties. The other Categories are described on the Perspective Component Properties page.

NameDescriptionProperty Type
maxUploads

The maximum number of concurrent (simultaneous) uploads to allow. Default is 5.

value: integer
supportedFileTypesAn array of string values, indicating what file types are allowed to be uploaded. Example values are "pdf" or "txt".array
fileSizeLimitSpecifies the maximum size of each uploaded file, in megabytes (MB). Default is 10 MB.value: integer
style

Sets a style for this component. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class.  

object

fileUploadIcon

Determines the icon used when the File Upload component is small.

 Click here to see fileUploadIcon properties
NameDescription Property Type
pathShorthand path to icon source, in format: library/iconName (i.e., material/arrow_right). The materials icon library is the default source for iconsin Ignition. See https://fonts.google.com/icons?selected=Material+Icons.value: string
colorColor of the icon. Here for convenience, may instead assign 'fill' in the styles property. Can be chosen from color wheel, chosen from color palette, or entered as RGB or HSL value. See Color Selector.color
object

Perspective Component Events
The Perspective Event Types Reference page describes all the possible component event types for Perspective components. Not all component events support each Perspective component. The Component Events and Actions page shows how to configure events and actions on a Perspective component. Component scripting is handled separately and can be accessed from the Component menubar or by right clicking on the component.

Component Events
 onFileReceived

Provides a chance to handle file data uploaded to the component.


Note: This component event is designed to be used in tandem with a script action. Within the script action, special properties and methods are available on the event object, which is passed to the script action as a parameter.

 event.file.name
  • Object Path

event.file.name

  • Type

String

  • Description

The name of the uploaded file.

 event.file.size
  • Object Path

event.file.size

  • Type

Integer

  • Description

The size of the uploaded file in bytes.

 event.file.copyTo(filePath)
  • Object Path

event.file.copyTo()

  • Description

Saves the uploaded file at a location accessible to the Gateway.

  • Parameters

String filePath - The path to where the file should be saved on the Gateway.

  • Return

none

 event.file.getBytes()
  • Object Path

event.file.getBytes()

  • Description

Fetches the incoming file data. Suitable for further data processing.

  • Parameters

none

  • Return

byteArray - The raw data of the incoming file.

 event.file.getString()
  • Object Path

event.file.getString()

  • Description

Fetches the incoming file data and attempts to parse it as a string via UTF-8 (Eight-bit UCS Transformation Format) encoding. Defaults to UTF-8 (super common), but can use other character sets. Passed as a string, for example getString("UTF_16BE).

  • Parameters

none

  • Return

String - The raw data of the incoming file as a string. 

 onUploadsCleared

This event is fired when the user has cleared all uploads, but not while uploads are still in progress.


Note: This component event is designed to be used in tandem with a script action. Within the script action, special properties and methods are available on the event object, which is passed to the script action as a parameter.

 event.file.name
  • Object Path

event.file.name

  • Type

String

  • Description

The name of the uploaded file.

 event.file.size
  • Object Path

event.file.size

  • Type

Integer

  • Description

The size (in bytes) of the uploaded file.

Example

For an example, see Download and Upload Files page. 

  • No labels