I've bashed together a really really simple one and I can send a .jpg
file locally on this machine and it works.
Alas the files I am wanting to send a .png
I nutted out the requirements for the message format/structure.
Given it works on the local machine, I construct the message with the same parameters but for the file name.
When I try to send it all I get at the receiving end is a lot of buffers.
The file is created with the correct name, but when I try to open it. . . . it doesn't work.
I may have to redact that.
Now even the local testing one is given the same error.
Here is the flow working locally.
[{"id":"494e9a80.744dcc","type":"change","z":"55b8031d.59ac1c","name":"Set values","rules":[{"t":"set","p":"source","pt":"msg","to":"/home/me/temp/source/wood1.jpg","tot":"str"},{"t":"set","p":"destination","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":200,"y":360,"wires":[["c5d30d1d.c419e"]]},{"id":"c5d30d1d.c419e","type":"change","z":"55b8031d.59ac1c","name":"Local file","rules":[{"t":"set","p":"localFilename","pt":"msg","to":"source","tot":"msg"},{"t":"set","p":"filename","pt":"msg","to":"destination","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":210,"y":400,"wires":[["ff82435d.67ab88","3bf59bbb.e37b8c"]]},{"id":"54df07e2.0caa88","type":"inject","z":"55b8031d.59ac1c","name":"","topic":"","payload":"wood1.jpg","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":320,"wires":[["494e9a80.744dcc"]]},{"id":"ff82435d.67ab88","type":"debug","z":"55b8031d.59ac1c","name":"Into FTP node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":420,"y":400,"wires":[]},{"id":"3bf59bbb.e37b8c","type":"ftp in","z":"55b8031d.59ac1c","ftp":"57b16114.aba468","operation":"put","filename":"","localFilename":"","name":"","x":690,"y":320,"wires":[["a546ce2.b051bb"]]},{"id":"a546ce2.b051bb","type":"debug","z":"55b8031d.59ac1c","name":"outgoing","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":700,"y":410,"wires":[]},{"id":"57b16114.aba468","type":"ftp","z":"","host":"192.168.0.6","port":"7021","secureOptions":"","user":"EXAMPLE","connTimeout":"","pasvTimeout":"","keepalive":""}]
It sends wood1
.jpg` through and I can open/see it in the new directory. (NO! Don't got there! It is a picture of a piece of wood.)
I know it is clunky how I construct the name. Gotta learn some how.
So: given that works.
This is what I use to send from the remote machine:
[{"id":"47c2f9b7.8a05c","type":"inject","z":"6733e955.eaa5a","name":"","topic":"","payload":"20191203-14.54.42.png","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":610,"wires":[["b441ce4f.f8b6c"]]},{"id":"b441ce4f.f8b6c","type":"function","z":"6733e955.eaa5a","name":"","func":"// Fix this line\nnode.warn(\"Node warning to follow\");\nlet path = flow.get('FTPPicturePath');\nnode.warn(\"Path \" +path);\n\nlet name = msg.payload;\nlet filename = msg.payload;\nmsg.source = path + name;\nnode.warn(\"Source \" + msg.source);\n\nmsg.localFilename = path + name;\nnode.warn(\"localFilename \" + msg.localFilename);\n\nmsg.destination = name;\nnode.warn(\"destination \" + msg.destination);\n\nmsg.filename = filename;\n\nreturn msg;","outputs":1,"noerr":0,"x":170,"y":550,"wires":[["dba401bd.395dc8","5a43c667.9818a8"]]},{"id":"5a43c667.9818a8","type":"ftp in","z":"6733e955.eaa5a","ftp":"bb00629f.12f49","operation":"put","filename":"","localFilename":"","name":"","x":340,"y":550,"wires":[[]]},{"id":"bb00629f.12f49","type":"ftp","z":"","host":"192.168.0.6","port":"7021","secureOptions":"","user":"EXAMPLE","connTimeout":"","pasvTimeout":"","keepalive":""}]
A bit more compact, because this is me really getting frustrated with errors and tracking it to the last possible point.
I get the file, but when I open it, I get the error shown above.
Yeah, I know: It is going to be a stupid mistake I made somewhere.
Alas I am not seeing it at time of posting.