Here is a simple version:
You can see that the expression on the set value and the insert, is the same:
However:
The set value output:
The inserted value:
Here is the code:
Server side
{
"meta": {
"options": {
"linkedFile": "/views/bugtest/simplefileupload.ejs",
"linkedForm": "form1"
},
"$_POST": [
{
"type": "file",
"fieldName": "input1",
"name": "input1",
"sub": [
{
"name": "name",
"type": "text"
},
{
"name": "type",
"type": "text"
},
{
"name": "size",
"type": "number"
},
{
"name": "error",
"type": "text"
}
],
"outputType": "file"
}
]
},
"exec": {
"steps": [
{
"name": "upload",
"module": "upload",
"action": "upload",
"options": {
"fields": "{{$_POST.input1}}",
"path": "/public/assets/bugtest/simpleimage",
"template": "{guid}{ext}"
},
"meta": [
{
"name": "name",
"type": "text"
},
{
"name": "path",
"type": "text"
},
{
"name": "url",
"type": "text"
},
{
"name": "type",
"type": "text"
},
{
"name": "size",
"type": "text"
},
{
"name": "error",
"type": "number"
}
],
"outputType": "file"
},
{
"name": "image",
"module": "image",
"action": "load",
"options": {
"path": "{{upload.path}}"
},
"outputType": "object",
"meta": [
{
"name": "width",
"type": "number"
},
{
"name": "height",
"type": "number"
}
]
},
{
"name": "",
"module": "image",
"action": "resize",
"options": {
"instance": "image",
"width": 65
}
},
{
"name": "newImage",
"module": "image",
"action": "save",
"options": {
"instance": "image",
"path": "/public/assets/bugtest/simpleimage/resized"
}
},
{
"name": "setvalueoutput",
"module": "core",
"action": "setvalue",
"options": {
"value": "{{newImage.getfilename()}}"
},
"meta": [],
"outputType": "text",
"output": true
},
{
"name": "insert",
"module": "dbupdater",
"action": "insert",
"options": {
"connection": "test_localhost",
"sql": {
"type": "insert",
"values": [
{
"table": "test",
"column": "value_test",
"type": "text",
"value": "{{newImage.getfilename()}}"
}
],
"table": "test",
"returning": "id_test",
"query": "insert into `test` (`value_test`) values (?)",
"params": [
{
"name": ":P1",
"type": "expression",
"value": "{{newImage.getfilename()}}",
"test": ""
}
]
}
},
"meta": [
{
"name": "identity",
"type": "text"
},
{
"name": "affected",
"type": "number"
}
]
}
]
},
"usedModules": {
"sharp": "^0.29.3"
}
}
And client side
<form id="form1" is="dmx-serverconnect-form" method="post" action="/api/bugtest/insertimagebug">
<div class="form-group mb-3">
<input type="file" class="form-control" id="input1" name="input1" aria-describedby="input1_help">
<button id="btn1" class="btn" type="submit">Button</button>
</div>
</form>