File Upload via Http Request node

Hi,

I’m trying to upload file to DMS service in SSD API.

What’s the proper configuration for Http Request node to send the multipart/form-data ?

I tried to send the file in various ways, but I’m constantly getting 400.


bh.local.url = `${process.env.DMS_URL}/file/create`;

bh.local.headers = {
  "Content-Type": " multipart/form-data"
};

bh.local.body = {
  file: bh.input.files.file[0]
};

and this doesn’t work as well


bh.local.url = `${process.env.DMS_URL}/file/create`;

bh.local.headers = {
  "Content-Type": " multipart/form-data"
};

const fd = new FormData();

fd.append(
  "file",
  bh.input.files.file,
);

fd.append("relativePath", "");

fd.append(
  "properties",
  JSON.stringify({
    title: "string",
    description: "string"
  })
);

fd.append(
  "options",
  JSON.stringify({
    autoRename: false,
    majorVersion: false,
    versioningEnabled: false
  })
);


bh.local.headers = {
  "Authorization": bh.local.token
};


bh.local.body = fd;

console.log('Body', bh.local.body)

Hi @Bartek,

What are you getting as a response ??
Are you getting any errors ??

1 Like

Hi @Simphiwe @Bartek
I am trying to implement the same thing. Did you guys find any solution for this? FormData is not supported by this Node, and the body is being sent as an empty object.