Send binary image file to dify

Describe the problem/error/question

I need to upload an image file to dify, but no matter what I do it doesn’t work and returns the error “Invalid upload file”.

When I use Postman to upload the file it works without problems, but in N8n it doesn’t. In Postman I upload the file directly and in N8n I’m converting base64 to binary and using this converted file.

This suggests that there is some problem in the binary generated by base64, but I can’t see a problem with it, because I can even view or download the file in n8n.

I’ve been at this for days and I can’t solve it.

What is the error message (if any)?

Invalid upload file

Share the output returned by the last node

Bad request - please check your parameters
Invalid upload file

Information on your n8n setup

  • n8n version: Version 1.63.4
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 20

Welcome to the community @willaimsael !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.

Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!


Why do you have to use base64 encode representaion in n8n? If that is the problem indeed, it would help to see how you transform the binary into base64 encoded version to figure out what is wrong. However, as you convert base64 to binary again I see no reason to transform to base64 in the first place.

hi, ihortom! How are you? Thanks for replying

The point here is that I receive the file in base64, convert it to binary in n8n and send the binary file to dify. But I’ve already been forced to change this, because apparently the problem is (or was) in the Dify API. So instead of using this structure, I’m saving the file in a database and just sending the public link to Dify. That worked.

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