Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.



Panel
titleGeneral

Component Palette Icon:



New_in
Version8.0.1


Panel
borderStylesolid
titleDescription

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.

Panel
titleProperties
Perspective_property


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


New_in
Version8.0.11


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

Expand
titleClick 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 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

Anchor
Component Events
Component Events

Info
iconfalse
titlePerspective 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.

Panel
titleComponent Events
Expand
titleonFileReceived

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.

Expand
titleevent.file.name
  • Object Path

event.file.name

  • Type

String

  • Description

The name of the uploaded file.

Expand
titleevent.file.size
  • Object Path

event.file.size

  • Type

Integer

  • Description

The size of the uploaded file in bytes.

Expand
titleevent.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

Expand
titleevent.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.

New_in
Version8.0.5


Expand
titleevent.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

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

Expand
titleonUploadsCleared
New_in
Version8.0.4



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.

Expand
titleevent.file.name
  • Object Path

event.file.name

  • Type

String

  • Description

The name of the uploaded file.

Expand
titleevent.file.size
  • Object Path

event.file.size

  • Type

Integer

  • Description

The size (in bytes) of the uploaded file.

Panel
titleExample

For an example, see Download and Upload Files in Perspective Common Tasks.