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 can't have the same name in the exact task definition. The name must be unique. |
true |
width |
The width of the HTML element. In the case of KCenter, UI must use width values based on %, for example:
|
false |
data |
When present, it is an identifier used to load data. For example, dynamically set the folderPath or folderUuid. |
false |
type |
Values:
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 is where the document will be stored. | false |
documentName | Forced name of the uploaded document. | false |
documentUuid | The uuid of the document is 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 the upload of several files. By default, the value is "false". |
false |
To upload a new document, you should set the folderPath or folderUuid, optionally documentName, if we want to force the document name. To update an existing document, you should set document Uuid and put type to edit.
Child elements:
|
Basic upload example
- 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>
Document updated
- 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-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 an example with dynamic parameters.
- Upload a document into a non-predefined folder.
- data is a valid mapping variable used to dynamically set the folderPath 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>
This is the Java code that sets the data and should be executed before the task which displays the form element:
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);
// Go to next node
ctx.getToken().signal();
}
}