# Need help with FTP

**URL:** https://discourse.nodered.org/t/need-help-with-ftp/18718
**Category:** General
**Created:** [3 December 2019 00:51 UTC](https://discourse.nodered.org/t/need-help-with-ftp/18718 "2019-12-03T00:51:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [3 December 2019 00:51 UTC](https://discourse.nodered.org/t/need-help-with-ftp/18718/1 "2019-12-03T00:51:15Z")

</div>

I have a couple of FTP nodes installed:  
`node-red-contrib-ftp-server`  
on the receiving device and:  
`node-red-contrib-ftp`  
on the sending machine.

Alas I am not really getting much done.

One wants `msg.filename` for the **remote** file name but it isn't honoured by the receiving node.  
(So it seems.)

All machines are local.

Could someone (please) show me a basic flow so I can send a file from "machine A" to "machine B" (or A for the sake of simplicity) where I specify:  
source path  
source file name  
destination path  
destination file name

Thanks in advance.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [3 December 2019 04:22 UTC](https://discourse.nodered.org/t/need-help-with-ftp/18718/2 "2019-12-03T04:22:56Z")

</div>

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.

 ![Screenshot from 2019-12-03 15-21-46](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/c/caac72cb5edbb55551ea509447b10ae8ed8acafd.png)

~~I may have to redact that.~~

Now even the local testing one is given the same error.

Here is the flow working locally.

```auto
[{"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:

```auto
[{"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.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [3 December 2019 09:26 UTC](https://discourse.nodered.org/t/need-help-with-ftp/18718/3 "2019-12-03T09:26:18Z")

</div>

I think I found the problem.

For some reason the filename is getting `.png` set.

See new post.
