File Upload

The File Upload Web Control collect files from a user. When users click on this Control, it will prompt them to select an item for upload. 

organizing info

The File Upload Web Control differs from other Web Controls in that it doesn't have a default appearance: the styling is entirely customizable, with other Web Controls used as component parts. See how to customize the appearance of a File Upload Web Control. Additionally, the File Upload Web Control does not come out of the box with input binding: rather than maintaining a variable that contains uploaded an Asset, it triggers Events with associated values related to the file's upload progress.

General

Control Properties

Type

The type of Asset the File Upload Web Control will accept. The default choices are Images, PDF, and video. If required to accept multiple types, add the asset types as an expression in quotes. 

For example: 

"image/jpeg", "image/png", "application/pdf", "image/svg+xml", "image/gif", "audio/mpeg", "video/mp4"

Allow Multiple Files

When checked, allows end users to select multiple files from the prompt that pops up.

Hash Type

The hash type selected from the dropdown will automatically generate a hash when files are uploaded to the Asset store.

470

Advanced Control Properties

Link Expiration

The number of milliseconds (an integer) that the downloaded Asset still has before expiration. This value is updated each time the download link is fetched.

This property is only valid on Assets with a visibility of type Private, and providing a value for this property will automatically make the uploaded Asset Private.

If the Link Expiration property is left blank, the Asset will be a global Asset. 

Image Size

Allows for resizing of Assets as they are uploaded. This property is an object representing the width and height in pixels for the uploaded Asset. It has the following properties:

width (type: Number)
The Number of pixels wide the Asset should be upon resizing.

height (type: Number)
The Number of pixels tall the Asset should be upon resizing.

Style

The elements within the File Upload Web Control can be styled.  For more information, see Common Style Properties of Web Controls.

Distribute Children

This provides the ability to distribute the elements evenly in the container of the File Upload Web Control, based off of the selected setting. 

Stacking settings include:

  • Stack Horizontal
  • Stack Vertical

Distribution settings include:

  • Top Left
  • Top Center
  • Top Right
  • Center Left
  • Center
  • Center Right
  • Bottom Left
  • Bottom Center
  • Bottom Right

Alignment of the items settings include:

  • Equal
  • Justify
  • Half & Whole

Actions

Associated Events

The File Upload Web Control has four associated Events:

  • On Upload Started Event - Triggered when the user chooses which file to upload
  • On Upload Progress Event - Triggered repeatedly while the file is being uploaded. Changes the value of event.value.progress as it increases incrementally from 0 to 1.
  • On Upload Finished Event - Triggered when the file has been uploaded and virus scan has completed successfully.
  • On Upload Failed Event - Triggered if an error occurs in creating and/or uploading the file. Changes the value of event.progress.error from NULL to something that reflects the nature of the error.

Referencing User Input

Rather than maintaining a variable that contains uploaded files, the File Upload Web Control triggers Events with associated values related to the file's upload progress. 

Every Event associated with a File Upload Web Control has access to a variable, event.value, with the following properties:

asset (type: Detailed Asset)
A Detailed Asset that references the uploaded file.
Note that a Detailed Asset is a subcategory of an Asset; it can be used as input for functions that require an Detailed Asset, such as ASSET_THUMBNAIL_URI or ASSET_STATE.

process (type: Number)
Represents how much of the file has been uploaded, where 0 represents a file that has just started the downloading process and 1 represents a fully downloaded file.
A value of 0.5, for instance, indicates that the file is 50% uploaded.

error (type: Any)
If an error has occurred, this will provide insight into the nature of the error. NULL otherwise.

To reference any of these properties outside the context of the Events associated with the File Upload Web Control, their values will need to be saved to Airdata or to variables of broader scope.

Advanced

State

Is Visible

A conditional field, which allows you to show or hide the File Upload Web Control depending on whether the defined condition is met.

The condition will always evaluate to a Boolean. TRUE means that the Control will be visible, FALSE means that it will not be.

Is Disabled

A conditional field, which disables the File Upload Web Control if defined condition is met.

The condition will always evaluate to a Boolean. TRUE means that the Control will be disabled, FALSE means that it will not be.