The File Upload Field Action – WS Form

File UploadPRO

The file upload field lets the user choose one or more files from their device storage to be uploaded.

Demo


To learn how to add, edit, clone, move, resize, offset, or delete a file uploader, please click here.

To edit the settings for this field type, click the settings icon on the field itself. Click the ‘Save & Close’ or ‘Save’ button to save your changes. If you do not want to save your changes, you can click the ‘Cancel’ button or click any other form element to close the field settings sidebar.
WS Form - Field Settings Icon

Basic

The basic tab contains settings that the majority of WS Form users will need to control a field. The settings are as follows:

Label

This is the label shown inside the field. As well as entering a label into this field, you can also double click the label of the field in the layout editor. You should enter an easy-to-understand label for your field, for example, ‘Resume’.

Button Label

This is the label that is shown in the file upload button, for example, ‘Browse’.

Note: This feature is only available if you are using one of the following frameworks: WS Form and Bootstrap 4+. Foundation uses the ‘Label’ setting for the button.

Required

If checked this field will be required when the website visitor completes your form. Failure to complete the field if this is checked will result in a validation message appearing under the field prompting the user to complete the field correctly.

Required fields are indicated on your website with the word ‘Required’ being adding to the label of the field. This can be changed in the form settings advanced tab.

Hidden

If checked the field will be hidden on the form. It can be shown again using conditional logic or your own JavaScript.

Multiple

If this setting is enabled, the website visitor will be able to choose more than one file to upload.

Directory

If this setting is enabled, the website visitor will be able to choose from an  entire directory with file contents (and any subdirectories) when uploading a file.

Help Text

The help text setting enables you to add smaller text under the field to assist the website visitor in completing that field.

As well as inserting plain text into this field, WS Form also provides extensive functionality for adding character and word count information. Click here to learn more about this functionality.

WS Form variables can be entered into this field.

Preview

The file preview feature allows you to show a preview of the selected file underneath the field.

Enable

Check this setting to enable the preview feature.

Orientation

Previews can either be oriented in a vertical, horizontal or grid format. Use this setting to determine which orientation you would like the previews to appear in.

If you select grid, you can set a width for each preview at each breakpoint. If you only change the smallest breakpoint, all of the other breakpoints will inherit that width too. This enables you to create multi-column layouts if you enable the multiple upload setting and upload more than one file.

Supported Formats

The following file formats are currently supported:

Images
  • apng
  • bmp
  • gif
  • jpeg
  • png
  • svg
  • tiff
  • webp
  • x-icon
Video
  • avi
  • mp4
  • ogg
  • ogm
  • ogv
  • webm
Audio
  • aac
  • aacp
  • flac
  • mp4
  • mpeg
  • ogg
  • wav
  • webm

The ability to view these files will depend on browser compatibility.

Image Optimization

Max Width (Pixels)

The maximum width in pixels the saved file should be. Leave blank for no change.

Max Height (Pixels)

The maximum height in pixels the saved file should be. Leave blank for no change.

Crop

If checked, images will be cropped to the maximum dimensions above using center positions.

Quality

Sets image compression quality on a 1-100 scale. Leave blank for no change.

File Format

The file format image uploads should be saved as.

Accessibility

ARIA Label

Accessible Rich Internet Applications (ARIA) defines ways to make web content and web applications more accessible to people with disabilities.

This setting enables you to define what text is made available to ARIA applications. This would, for example, provide a screen reader with specific text to read to someone with a disability.

The value of this setting defaults to your field label. If you would like to change this, enter a new value.

WS Form variables can be entered into this field.

Exclusions

Exclude From Emails

By default, WS Form uses the #email_submission variable in email templates. This provides a simple way of displaying all of the submitted fields in emails. Sometimes there might be a need to exclude a field from an email, for example, you might want to not include some introductory copy on a form, or hide a field you’re using with conditional logic to show or hide an element.

To hide a field from emails, check this box.

Other WS Form add-ons may add exclusions in this section too, such as the WooCommerce add-on which allows you to exclude certain fields from the cart entries.

Hidden Behavior

Always Include in Actions

This setting allows you to change the behavior of a field if the hidden setting is checked (See above), or if you set a field as hidden using conditional logic.

The normal behavior for a field that has been hidden is that it will not be included if an action has a ‘Clear Hidden Fields’ setting enabled. For example, if you have a ‘Send Email‘ action, WS Form will not include fields that are hidden.

If this setting is checked, this field will always be included in actions if it is hidden.

Advanced

The advanced tab contains additional form attribute settings that provide further control over how a field is rendered.

Styles

Use the ‘Styles’ settings to change the design of the file upload field.

Vertical Alignment

The vertical alignment option allows you to choose how this field will be vertically aligned in relation to fields in the same row. The options are:

  • Top
  • Middle
  • Bottom

Classes

For developers WS Form allows you to add your own classes to fields.

Field Wrapper

The wrapper CSS class setting enables you to add a class (or classes) to a field wrapper. Field wrappers are sections of HTML added around a field to position them on the page. To add multiple classes, add a space between the class names.

Field

To add a class to the actual field element itself, enter a class (or classes) to this setting. To add multiple classes, add a space between the class names.

Restrictions

Field restrictions enable you to define what can or cannot be entered into the field.

Disabled
User Status

Choose from one of the options to filter which user status can see this field:

  • Any
  • Is Logged In
  • Is Logged Out
  • Has User Role or Capability

If you choose ‘Has User Role or Capability’, additional settings will appear that enable you to choose one or more roles or capabilities.
If checked the field will be disabled, and it cannot be interacted with. You can re-enable a field dynamically by using conditional logic.

File Restrictions

File Types

You can limit the types of files that can be uploaded by specifying one or more MIME types in this field. Multiple MIME types should be separated by commas.

For example: application/pdf,image/jpeg

This would limit the file uploads to PDF documents and JPG images.

A list of some of the most common MIME types can be found by clicking here.

Validation

Show Invalid Feedback

Invalid feedback text is shown when a form is saved or submitted and the field has not been completed according to the field settings you have configured. For example if the minimum character count is 10 and you enter 5 characters and then submit the form, the field will be deemed invalid. If this setting is checked, invalid feedback is shown under the field.

Invalid Feedback Text

WS Form automatically builds invalid feedback text for all of your fields. If no text is entered into this field, the value shown in the field in light gray text will be shown. If you would like to specify alternative invalid feedback text, you can enter it within this setting.

WS Form variables can be entered into this field.

Custom Attributes

This setting is used to add custom attributes to the HTML of this field, such as data-my-attribute="1234". You can add as many custom attributes as you need.

To add a custom attributes key value pair:

  1. Click the ‘Add’  icon to add a custom attribute row.
  2. Enter the key in the left column.
  3. Enter the value in the right column.
  4. Click ‘Save’ to save the custom attributes.

Breakpoints

The breakpoint settings define the width of a field and also what the offset (how many columns from the left-hand side of the form or the previous field) of a field is for each breakpoint. For more information about the breakpoint settings and capabilities of WS Form, click here.