Skip to main content
Skip table of contents

FileUpload

The <FileUpload> control can be used to upload files to a Web App created with X4 Web Apps. The <FileUpload> control can only be used in Detail Components or Detail Structure Elements within Master/Detail Components.

The <FileUpload> control uses the standard Open File dialog of the browser, where the user can select the file to be uploaded. After the user selects the file, the upload starts. The Technical Process that receives the uploaded file must return a confirmation or an error message. If the confirmation contains a message, this message is displayed as a pop-up window. Pop-up windows with error messages are displayed in any case.

Note:

When using a mobile device, the integrated camera can also be accessed.

In addition to the default attributes listed under Controls, the following attributes can be defined for the <FileUpload> element:

Attribute

Description

acceptedFileTypes 

File type to filter by in the selection dialog.

  • Data binding possible

This attribute filters only by file types. The filter can be reset by the user to display and select all file types.

Possible values:

Any string (file extension)

Note:

Only enter the file extension for this attribute. For example, pdf. MIME types and wildcards (*) are not allowed.

autoUpload

Determines whether automatic file upload is enabled.

  • Data binding (boolean) possible

Possible values: 

true/false or data binding expression

displayName

Display name in the interface.

Possible values: Any string

fileId

Identifier that can be used by the process developer.

  • Data binding possible

Possible values: Any string

maxSizeMB 

Maximum file size in megabyte.

Possible values: Integer

multipleFiles

Determines whether multiple files can be uploaded.

Possible values: true/false

Note:

Multiple files are uploaded using the multipart upload mechanism. This allows for efficient handling of large files with less server load.

process

Required. Technical Process that receives the uploaded file.

The Technical Process must be specified including file extension.

Possible values: String (URI)

Input Format for the Technical Process

The data is transmitted to the Technical Process in a specific input format.

XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<File>
    <FileId>....</FileId>
    <FileName>....</FileName>
    <FileType>....</FileType>
    <FileData>
    ....Base64 data....
    </FileData>
</File>

The data in the <FileData> element can be decoded with the (7.4.0-en) Base64 Converter, for example.

Example for the <FileUpload> Element

XML
<DetailComponent
	xmlns="http://softproject.de/webapp/1.0">
	<Actions>
		<UploadAction process="FileUpload.wrf"></UploadAction>
	</Actions>
	<FlowLayout>
		<Header value="Default" titleLevel="subtitle" />
		<FileUpload process="FileUpload.wrf"
			displayName="Upload" />
		<Label value="" />
		<Header value="Multiple files" titleLevel="subtitle" />
		<FileUpload process="FileUpload.wrf" multipleFiles="true"
			displayName="Upload" />
		<Label value="" />
		<Header value="Autoupload multiple files"
			titleLevel="subtitle" />
		<FileUpload process="FileUpload.wrf" multipleFiles="true"
			autoUpload="true" displayName="Upload" />
		<Label value="" />
	</FlowLayout>
</DetailComponent>

The above code leads to the following result:

image-20240627-112920.png

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.