Request-promise-native file upload

Hello, I am trying to upload file and json value to seatable api.

when i try with postman and webhook.site, i am getting the following screenshot.

However, when i try out with n8n and webhook.site, i am not getting file to be uploaded.

below are my last 2 node.
image

inside merge node, the binary file are labelled as following

I am trying to get file name data to uploaded.

below are my request-promise-native code.

const request = require('request-promise-native');   //need to reinstall n8n with variable here to use it

let address = "https://webhook.site/34135ea4-c0d1-42ab-b07c-8323a44376cc?"

let parentdir = items[0].json.parent_path

let imagePath = items[0].json.img_relative_path

const x = "Token 5d________________________0a5"  //authorization key

const binaryData = items[1].binary.data;      //name of file is called "data under items[1] obtained from previous node"

const metadata = {
  name : binaryData.fileName,

}

const options = {

  uri: address,    //url to send http post
  headers: {
    'content-type': 'multipart/form-data',
    'Authorization' : `${x}`,

  },
  

   formData: {
    image: {
      value: Buffer.from(binaryData.data, 'base64'),
      options: {
	    filename: binaryData.filename,
	  }
 	}
    
  },
  method: 'POST',
}

const response = await request(options);

return [{ json: {response} }]   //display respond from http request in json. 

I just had a quick look and noticed that you call the file “file” in postman, and in the function node, you call it image.

What do you want to upload? The three files? Or only one? If it’s only one, which one do you want to upload? data, data1 or data_json?

sorry for the confusion, i would like to upload with name “file” … i copied the requet-promise native code from another workflow that is working and forget to change the name to file ( instead of image )

i would like to upload the “data” file only. only 1 file.

Hello, i forgot to mention that even after i change the name to “file” , i am still getting the same result.

The same you mentioned above happened to me. When you send the request from the function node, it does not get uploaded, but it does when you do it from the HTTP node. I’m going to investigate and report back.

1 Like