Ftp node file access

Hi,
I have used ftp node to connect to sftp server, but need to be able to save or read file. Any examples would be great. What is associated nodes that can be used …Read Binary file node is there, but for some reason can’t use it.

1 Like

Here how to upload a file:

{
  "nodes": [
    {
      "parameters": {
        "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Test-Logo.svg/1200px-Test-Logo.svg.png",
        "responseFormat": "file",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        650,
        600
      ]
    },
    {
      "parameters": {
        "protocol": "sftp",
        "operation": "upload",
        "path": "/share/test.png"
      },
      "name": "FTP1",
      "type": "n8n-nodes-base.ftp",
      "typeVersion": 1,
      "position": [
        800,
        600
      ],
      "credentials": {
        "sftp": "local sftp"
      }
    }
  ],
  "connections": {
    "HTTP Request": {
      "main": [
        [
          {
            "node": "FTP1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

In this example, it gets the file to be uploaded from the internet. But it could be also any other file that can “get” binary data (Read File, Email Read IMAP, FTP, Dropbox, NextCloud, …)

And here an example of how to download the above uploaded file:

{
  "nodes": [
    {
      "parameters": {
        "protocol": "sftp",
        "path": "/share/test.png"
      },
      "name": "FTP3",
      "type": "n8n-nodes-base.ftp",
      "typeVersion": 1,
      "position": [
        800,
        900
      ],
      "credentials": {
        "sftp": "local sftp"
      }
    }
  ],
  "connections": {}
}

Thank you so much, will try these examples

Hey @dsuresh, I’ve also updated the documentation to include an example workflow which might be of help: https://docs.n8n.io/nodes/n8n-nodes-base.ftp/ :slight_smile:

1 Like

How do I specify target path for sftp download operation, currently its downloading to user default path.

Do not understand. It should by default not get saved by the FTP Node anywhere. It should only end up as binary data in the workflow. You can then “use” that binary data with the"Write Binary File" Node and save it wherever you want.

My bad. I saw a file, thought it was downloaded from ftp node.

No problem. Great to hear that you figured it out.