You're currently browsing the Ignition 8.0 docs. Click here to view the latest docs.



General

Component Palette Icon:



The following feature is new in Ignition version 8.0.1
Click here to check out the other new features

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

The following feature is new in Ignition version 8.0.11
Click here to check out the other new features
Determines the icon used when the File Upload component is small.

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 icons in 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

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

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.

  • Object Path

event.file.name

  • Type

String

  • Description

The name of the uploaded file.

  • Object Path

event.file.size

  • Type

Integer

  • Description

The size of the uploaded file in bytes.

  • 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

  • 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.

The following feature is new in Ignition version 8.0.5
Click here to check out the other new features

  • 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.

The following feature is new in Ignition version 8.0.4
Click here to check out the other new features

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

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.

  • Object Path

event.file.name

  • Type

String

  • Description

The name of the uploaded file.

  • 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 in Perspective Common Tasks.

  • No labels