Skip to content

Workflow Upload field

Upload is used to upload a document.

Attribute Description Required
label The text 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 percentages; 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
visible This attribute only makes sense when used in conjunction with an object mapped in the data attribute; the visible value of the object mapped in data is assigned to the form field, causing it to be shown or hidden (the most common use is to hide it). The default value of visible is true. false
type Values:
- create (the operation will create a new document)
- update (the operation will 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 to be uploaded. For example:
pdf;png
false
multiple When true, it allows uploading multiple files. The default 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-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.6//EN"
    "http://www.openkm.com/dtd/workflow-forms-2.6.dtd">
    <workflow-forms>
    <workflow-form task="upload test">
    <upload name="upload" label="Upload document" folderUuid="fca2d85e-0e01-418d-b699-c0dd0f8190da" />
    </workflow-form>
    </workflow-forms>
  • Create a new version of an existing document.
  • documentUuid is the UUID of the document to be updated.
  • The type attribute must be set to update.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.6//EN"
"http://www.openkm.com/dtd/workflow-forms-2.6.dtd">
<workflow-forms>
<workflow-form task="upload test">
<upload name="upload" label="Upload document" type="update" documentUuid="e6a06309-c1cf-42be-98fd-7d7ed83ebda8" />
</workflow-form>
</workflow-forms>
  • Upload a document to a folder determined at runtime.
  • The data attribute is a mapping variable used to dynamically set the folderPath or folderUuid attribute.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.6//EN"
"http://www.openkm.com/dtd/workflow-forms-2.6.dtd">
<workflow-forms>
<workflow-form task="upload test">
<upload name="upload" label="Upload document" data="updData" />
</workflow-form>
</workflow-forms>

The following Java code must be executed before the task that displays the form. It sets the target folder dynamically:

import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
import com.openkm.bean.form.Upload;
public class UploadAction implements ActionHandler {
private static final long serialVersionUID = 1L;
@Override
public void execute(ExecutionContext ctx) throws Exception {
Upload upd = new Upload();
upd.setFolderPath("/okm:root/dstFld");
ctx.setVariable("updData", upd);
// Proceed to the next node
ctx.getToken().signal();
}
}