Aggregate files/images before editing and sending to OpenAI

I’m trying to Aggregate files/images from several executions to one output before editing and sending to OpenAI
Is it possible to do?


[email protected]

You could setup a workflow which collect artifacts you need (files, images) and store them somewhere, then another workflow to check if all documents were collected (with whatever logic you see fit - number of documents or certain file names) and then perform operations on them and sending them to OpenAI or anywhere else. Would that work for you?

I thought about it, but Save&upload from storage outside n8n looks like extra action. I send 1-3 files/images to Telegram and need to send it to OpenAi like image prompt.

If the artifacts come at different times (the trigger get…triggered more than once), you do need to preserve files somewhere and introduce the checking logic for when to start processing them (batch sending them somewhere). It doesn’t even have to be two separate workflows - trigger gets the file - stores it, checks if all files are there - send to openai, if not finishes and waits for the next trigger.

Could I preserve in n8n database or memory?

Are you running a self-hosted version?

no, now its work n8n website.

Then you cannot write files locally (I don’t believe cloud version even has “Write Files to Disk” node or other type of persistent storage…

I moved to self-hosted version.
And now I see Write Files to Disk.
As I understand I need to save all files to local disk until I receive a command from telegram to start process? When I read all files and delete them from disk?

Or you can be checking for the complete set of files (if there is such thing) after each file is uploaded. If the number of files are not always the same - then yes, you can then just use a final command to green light the process.

Oh… Next problem is: Write to Disk couldn’t save file.
From Read/Write Files from Disk

Error code

ENOENT

Full message

ENOENT: no such file or directory, open '/opt/n8n_data/file.jpg'

but directory exists.
n8n installed without docker.

Is that folder writable?
try write something to /tmp

/tmp done


If I write without path it write too, but, when I tried to save to files/fulename.jpg - permissions error because this shared folder for ROOT, but n8n writing through another user?


like this.

With docker you can mount a folder anywhere in the system and make it available to any user. I always have a folder which I use to share files with n8n workflows.

1 Like

Thanks for your help. Everything works!)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.