How to save attachment to dropbox with the original file name

I currently listen for emails on a gmail account through IMAP. Then I have a connection to dropbox. But the dropbox requires a file name. Is there a way to add a random file name or add it based on the value of the file name attachment coming from gmail?

This is how my workflow looks like

Welcome to the community @Christo_S!

Yes, you can change the parameter on the Dropbox node to an expression and then select the filename via the expression editor:

The resulting expression will then be something like:


Hi jan & thank you, I did that but for the IMAP node i couldn’t see the binary field. Doing it with the Gmail node works for to get the binary but I get this error if I try to save to dropbox

This is how my binary data looks like in the gmail node

You have to set the expression I did post above in the field “File Path” (probably add the folder /App in front of it).

For “Binary Property” you have to set the value “attachment_0” because that is the name of the binary property that contains the data. The property data does not exist as you can see in your screenshot above (the only one that exists is attachment_0).

Ah yeah, i did do that and it worked great for the file name to be equal to the attachment file name. However this is how it looks like after adding the attachment_0 as the binary property. I also tried adding it as the raw value of the binary

And adding the variable editor values just in case (only keys are relevant)

“Binary Property” does not have to be an expression. It is just a string. This is however not the problem here, just to be complete.

The problem you have is caused by you receiving multiple messages (in this case 10) and only one having an attachment and so binary data. So it will only work for 1 of the 10 and for 9 of 10 it will display the error you can see (as there is nothing the Dropbox node could upload).
So what you would have to do is to filter the items(messages) with an IF-Node. So that the Dropbox node will only be executed for the items that contain binary data.

1 Like

Hi jan, that worked ! great to be part of this amazing project & thank you for the effort.

Very great to hear that you got it working and to have you as part of the community.

Have fun!