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
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.
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.