# Uploading Profile Pic with NodeJS

**URL:** <https://devforum.zoom.us/t/uploading-profile-pic-with-nodejs/17266>\
**Category:** API and Webhooks\
**Created:** [May 12, 2020, 3:44pm UTC](https://devforum.zoom.us/t/uploading-profile-pic-with-nodejs/17266 "2020-05-12T15:44:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/daniel1/32/8262_2.png) [@daniel1](https://devforum.zoom.us/u/daniel1)\
**Post date:** [May 12, 2020, 3:44pm UTC](https://devforum.zoom.us/t/uploading-profile-pic-with-nodejs/17266/1 "2020-05-12T15:44:05Z")

</div>

**Description**  
I am trying to upload a profile picture with Node.js and the form-data/axios modules and nothing is working

**Error**  
Response contains:

{ data: { code: -1, message: “Required request part ‘pic\_file’ is not present” } }

**Which App Type (OAuth / Chatbot / JWT / Webhook)?**  
OAuth

**Which Endpoint/s?**  
/v2/users///picture

**How To Reproduce (If applicable)**  
Code I’m using:

const img = request.body.base64img;  
const imgParts = img.split(’,’);

const userid = request.body.userid;

const stream = bufferToStream(Buffer.from(imgParts[1], ‘base64’));

let formData = new FormData();  
formData.append(‘pic\_file’, stream);

axios.post(`https://api.zoom.us/v2/users/${userid}/picture`, formData, {  
headers: {  
…formData.getHeaders(),  
‘Authorization’: `Bearer ${adminToken.admin_token}`  
}  
}).then(response =\> {  
console.dir(response);  
}).catch(err =\> {  
console.log(err);  
});

bufferToStream just takes a Buffer and converts it to a stream … I was only trying that to see if it worked.

Anyone have any experience with this?

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [May 18, 2020, 5:32pm UTC](https://devforum.zoom.us/t/uploading-profile-pic-with-nodejs/17266/2 "2020-05-18T17:32:44Z")

</div>

Hey @daniel1,

Have you tried the Node.js sample code on our [docs](https://marketplace.zoom.us/docs/api-reference/zoom-api/users/userpicture)?

```auto
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "api.zoom.us",
  "port": null,
  "path": "/v2/users/me/picture",
  "headers": {
    "content-type": "multipart/form-data;",
    "authorization": "Bearer access_token"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.end();

```

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 9:22pm UTC](https://devforum.zoom.us/t/uploading-profile-pic-with-nodejs/17266/3 "2020-08-21T21:22:26Z")

</div>

Closed on August 21, 2020, 9:22pm UTC


