Skip to content

Workflow Upload field

Upload is used to upload a document.

Attribute Description Required
label The text is shown as a label in the user interface. true
name Unique name identifier.
Two fields cannot have the same name in the same task definition. The name must be unique.
true
width The width of the HTML element.
In the case of KCenter, the UI must use width values based on %, for example:
- width=“50%” will work.
- width=“100px” will be ignored in the KCenter UI.
false
data When present, it is an identifier used to load data.
For example, dynamically set the folderPath or folderUuid.
false
type Values:
- create (the operation will be to create a new document)
- update (the process will be to update the existing document)
When it is not present, the default value is set to “create”.
false
folderPath The folder path where the document will be stored. false
folderUuid The folder UUID where the document will be stored. false
documentName Forced name of the uploaded document. false
documentUuid The UUID of the document to be updated. false
allowedExtensions Set the document extensions that are allowed for upload. For example:
pdf;png
false
multiple When true, it allows the upload of several files. By default, the value is “false”. false

Child elements:

  • Upload a new document to a folder.
  • folderUuid is a valid folder UUID. You can also use folderPath and set a path, which is more human-readable.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-form PUBLIC "-//OpenKM//DTD Workflow Form 1.0//EN"
"https://www.openkm.com/dtd/workflow-form-1.0.dtd">
<workflow-form task="upload test">
<upload name="upload" label="Upload document" folderUuid="fca2d85e-0e01-418d- 699-c0dd0f8190da" />
</workflow-form>
  • Create a new version of a given document.
  • documentUuid is the UUID of the document to be replaced.
  • Note the type parameter, which is set to “update”.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-form PUBLIC "-//OpenKM//DTD Workflow Form 1.0//EN"
"https://www.openkm.com/dtd/workflow-form-1.0.dtd">
<workflow-form>
<upload name="upload" label="Upload document" type="update" documentUuid="e6a06309-c1cf-42be-98fd-7d7ed83ebda8" />
</workflow-form>

Upload an example with dynamic parameters.

Section titled “Upload an example with dynamic parameters.”
  • Upload a document into a non-predefined folder.
  • data is a valid mapping variable used to set the folderPath attribute dynamically.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-form PUBLIC "-//OpenKM//DTD Workflow Form 1.0//EN"
"https://www.openkm.com/dtd/workflow-form-1.0.dtd">
<workflow-form>
<upload name="upload" label="Upload document" data="updData" />
</workflow-form>

This is the Java code that sets the data and should be executed before the task that displays the form element:

import com.openkm.sdk4j.impl.OKMWebservices;
import com.openkm.sdk4j.bean.*;
import com.openkm.okmflow.util.*;
import com.openkm.okmflow.bean.*;
import com.openkm.bean.form.*;
import com.openkm.util.*;
Upload upd = new Upload();
upd.setFolderPath("/okm:root/dstFld");
context.put("updData", upd);