Errors on reading and writing files

Hi! I have a problem: can’t read and can’t write binary files. Maybe this is the same issue, maybe different.

Reading. So I created the local-files folder on my server, according to the Installation process, and put there picture.jpg file. I try to read it with Read binary file. This is my path:
image

This is the error message:
image

Writing. I use the workflow for writing files, this is the path:
image

And this is the error:

The errors look different, but seem the same. I even gave all the possible permission to the folder on my server (which I think I haven’t been asked to do).

Does the folder exist?

Yes

And you are saying that this ../local-files folder is equal to /local-files on the instance or docker container which runs n8n? Because if yes, then it has to work. So I would assume that is not the case.

My folders are like that:

The last two paragraphs of the 5. Create docker-compose file step talks about how to setup n8n to use the Write Binary File node. Did you follow those steps?

1 Like

Yeah. Initially I didn’t add the “files” line, but when started working with binaries, I added the line, stopped , removed and started again docker containers.

The “local-files” folder apeared on the first level of the server. But I don’t know how to check if n8n “sees” it al all.

I’m the root user so I didn’t have to do the very last paragraph.

Maybe this some node.js limiations and I have to do smth with that?

@RicardoE105 , the very last part says to use “files” in n8n, I didn’t get it first.

So it fixed. Thank you to point this out.

Glad that you could figured it out. Have fun.

Thank you.
By the way, does it mean that for reading and writing I shoud use this fixed folder? I mean, n8n seems not seeing any other folders (just subfolders) besides “files” (“local-files” on server).

If you run n8n in Docker then it is totally different to your “host system”. It will only get access to the files you give it access to (via that one line). You can add as many of them as you want and you can name them however you want. But if you want that you can access them from your host system you have to add a volume mount.

Btw. looking at your screenshot from above does it look like you actually have to use /files inside of n8n instead of /local-files because you tell Docker to mount /local-files (host system) to `/files (inside of Docker and so n8n). Again you can choose whatever names you want.

I got it, thank you. Just to mention the folders I need for the docker-compose.

As far as naming difference is concerned, I took them from the official page. So my “server” and “n8n” names for folders are different. Maybe it needs to be changed in the guide.
image

Just checked. The documentation is already correct and explains exactly what is happning:

Yes, this is what @RicardoE105 pointed at and finally helped me. I remember last time I read there was no this explanation and I didn’t get how it works.

Yes, we are constantly improving the documentation. So quite possible that it got improved between the time you checked it last. Glad that it works now.

1 Like