I understand for Cloud the file path to Write Binary File is /home/node/.n8n/filename.extension, but how would I refer to a field within the previous nodes binary data to update the filename?
For example, lets say I have a field ‘surname’ in the binary data of the file (having used ‘Move Binary Data’ from JSON to Binary), and that first files (say out of 10 files) ‘surname’ was Smith, how could I get the Write Binary File to show /home/node/.n8n/Smith.pdf as I’m getting a bit stuck on the expression used within the file name? Would /home/node/.n8n/{{$json.surname}}.pdf work?
Also, given I’ve made several attempts at this, how can I actually know what the exported file looks like to see it’s naming convention? Is the only way to attach a subsequent node and send it to myself via email or similar?
Thanks
Hi @spessex, my recommendation would be not to store anything on the filesystem of your n8n cloud system. You wouldn’t be able to easily delete or inspect such data.
You’re typically much better off storing data on an FTP server you have control over or a service such as Google Drive or Dropbox that come with a UI to view your data.
That said, the expression you have shared should work. I just tried saving a file on my n8n cloud instance like so:
I could then read it from /home/node/.n8n/jason-hudson-BjXody9fWKo-unsplash.jpg
as expected:
Thanks @MutedJam. I can’t figure out how to send a file to Google direct from within ‘Write Binary File’ from the file path and I’m not sure if Google even allows this having tried to find a solution for the url to send it to.
I do however have an ftp account for a Siteground service but again am unsure as to the path I would need to add as it would require authentication credentials. Is there a specific format to add the ftp url and accompanying credentials?
I’ve since discovered the ftp format path but keep getting ERROR: ENOENT: no such file or directory, open, even though I know I’m using the correct ftp path details (as advised by Site Ground support). Does the file path definitely support sending to an FTP?
The main issue I have is that there’s just no way of telling if I’m writing the binary file correctly as I have no way of viewing it
PS path I’m using is ftp://[email protected]:[email protected]/domain.me/n8n
Yes, that’s why I’d avoid writing data to the cloud instance filesystem. It’s not easy to work with.
Thanks @MutedJam. I can’t figure out how to send a file to Google direct from within ‘Write Binary File’ from the file path and I’m not sure if Google even allows this
You wouldn’t use the Write Binary File node when sending data to Google Drive. To write binary data to Google Drive you’d use the Google Drive node. Same for FTP uploads, there’s a designated FTP node for that.
Or in other words: There is no need to write the binary data to the filesystem first. As soon as you have a binary item you could connect the node with the binary item to the Google Drive or FTP node.
As for your initial problem of getting the filename right, can you confirm how exactly your data looks like?
Thanks @MutedJam. All understood and thanks for the heads-up.
1 Like
You are most welcome! Give me a shout if you run into any further trouble with this