Beginner needs helps with Dropbox Upload

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

Running latest version ona npm hosted on hostinger

Hi - I am a beginner and starting a first project to learn. I am currently stuck and need help to fix.

I have a Gmail Trigger to get scan I have sent to me. I get the attached file, send it to Atheopic to determine what is best file title and then I want to upload in a Dropbox folder .

Up to Anthropic folder I am good, but I am unable to upload the file using Dropbox Upload node. Binary file has been lost after Anthropic node.

Anybody can help ? Thanks a lot

Hello - I feel stupid but I do not have such node “Move Binary File” within n8n. Is it “Convert to File” and then “Move base64 string to File”? Thanks

Thanks. How should I do it?

Hi - I have copy/paste in a fresh new n8n Workflow. Links between “Extract Attachments”, “Analyze document”, and “Merge Filename with Binary Data” nodes are not being pasted correctly. I have tried replacating yours but Code node does not allow it. Shoudl I sue a Code node ?

I did it nd got that message on “Merge Filename with Binary Data”: $(…).item is not a function [line 3]

@csimonnet heres a fixed workflow

@csimonnet if you found it helpful kindly mark as the solution to help others.

Hi - This is not fixing it. I am getting following error in “Merge Filename” node : Cannot read properties of undefined (reading ‘binary’) [line 17]

TypeError

@csimonnet thats cos the merge file name with binary data node is not receiving the binary data from the extract attachments node.

// This node merges the AI-generated filename with the original binary data
const aiOutput = $input.all()[0]; // AI response (from Analyze document)
const originalData = $input.all()[1]; // Should be from Extract Attachments

// DEBUG: Check what we're actually receiving
console.log('AI Output:', JSON.stringify(aiOutput.json, null, 2));
console.log('Original Data:', JSON.stringify(originalData, null, 2));

// Get the suggested filename from Anthropic
let suggestedFilename = aiOutput.json.text || aiOutput.json.response || 'document';

// Clean the filename
suggestedFilename = suggestedFilename
  .replace(/\.[^\.]+$/, '')
  .replace(/[^a-zA-Z0-9\s_-]/g, '')
  .trim()
  .replace(/\s+/g, '_')
  .toLowerCase();

// Handle the binary data - it might be in different locations
let binaryData = null;
let originalFileName = 'unknown';

if (originalData.binary) {
  // Data comes from direct binary connection
  binaryData = originalData.binary;
  const binaryKey = Object.keys(binaryData)[0];
  originalFileName = binaryData[binaryKey].fileName || 'unknown';
} else if (originalData.json && originalData.json.originalData) {
  // Data comes through JSON (fallback)
  // You might need to reconstruct binary data here
}

// Get original file extension
let fileExtension = '.pdf';
const extensionMatch = originalFileName.match(/\.([^.]+)$/);
if (extensionMatch) {
  fileExtension = '.' + extensionMatch[1];
}

// Combine suggested filename with original extension
const finalFilename = suggestedFilename + fileExtension;

// If we don't have binary data, try to get it from the original source
if (!binaryData) {
  const extractNodeData = $('Extract Attachments').item();
  if (extractNodeData && extractNodeData.binary) {
    binaryData = extractNodeData.binary;
  }
}

if (!binaryData) {
  throw new Error('No binary data found for file upload');
}

return [{
  json: {
    suggestedFilename: suggestedFilename,
    finalFilename: finalFilename,
    originalFilename: originalFileName
  },
  binary: binaryData
}];

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