# How to upload a file using http request

**URL:** https://discourse.nodered.org/t/how-to-upload-a-file-using-http-request/87737
**Category:** General
**Tags:** http-request
**Created:** [6 May 2024 06:38 UTC](https://discourse.nodered.org/t/how-to-upload-a-file-using-http-request/87737 "2024-05-06T06:38:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![praveenkumarreddy849](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@praveenkumarreddy849](https://discourse.nodered.org/u/praveenkumarreddy849)
#### Post date: [6 May 2024 06:38 UTC](https://discourse.nodered.org/t/how-to-upload-a-file-using-http-request/87737/1 "2024-05-06T06:38:22Z")

</div>

Hi Community,  
I'm new to node red and I'm trying to upload a file in the Http request, It is looking different from doing in postman,  
Any help or guidance would be invaluable

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [6 May 2024 08:10 UTC](https://discourse.nodered.org/t/how-to-upload-a-file-using-http-request/87737/2 "2024-05-06T08:10:17Z")

</div>

Did you try out any of the flow examples here: [Library - Node-RED](https://flows.nodered.org/search?term=upload&type=flow)

Or check out the forum: [Search results for 'http request file upload order:latest' - Node-RED Forum](https://discourse.nodered.org/search?q=http%20request%20file%20upload%20order%3Alatest)

---

<div class="post-metadata">

### Author: ![praveenkumarreddy849](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@praveenkumarreddy849](https://discourse.nodered.org/u/praveenkumarreddy849)
#### Post date: [7 May 2024 10:28 UTC](https://discourse.nodered.org/t/how-to-upload-a-file-using-http-request/87737/3 "2024-05-07T10:28:15Z")

</div>

Hi @Steve-Mcl ,

Thanks for your Suggestion,

I have found a[thread for file upload scenario](https://discourse.nodered.org/t/form-data-multipart-encoded-request-with-pdf-file-attached-into-the-body/44749)

Which has given me a path to resolve this as below

```auto
var base64Data = msg.encodedFile;
var buffer = Buffer.from(base64Data, 'base64');

var formData = {
    file: {
        value: buffer,
        options: {
            filename: `${msg.fileName}`,
            contentType:`${msg.fileType}`
        }
    },
}

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [21 May 2024 10:29 UTC](https://discourse.nodered.org/t/how-to-upload-a-file-using-http-request/87737/4 "2024-05-21T10:29:07Z")

</div>

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