---
title: "Comment by Sidharth Kumar on \"Build a REST API with Node.js: Upload an Image File\" | Hashnode"
description: "Hi Victoria Lo , Awesome tutorial.Its really very good tut. I have problem while using image upload from postman. Only when i use form-data method &#39;post&#39"
url: "https://hashnode.com/posts/build-rest-api-with-nodejs-upload-files-mongodb/5f2cb59d3b12e25afe3e42df/comment/6019606f58cc670f3df464e5"
---

[Discussion](https://hashnode.com/posts/build-rest-api-with-nodejs-upload-files-mongodb/5f2cb59d3b12e25afe3e42df)

Comment [Build a REST API with Node.js: Upload an Image File](https://hashnode.com/posts/build-rest-api-with-nodejs-upload-files-mongodb/5f2cb59d3b12e25afe3e42df)

[Sidharth Kumar](https://hashnode.com/@Sidk)

[Feb 2, 2021](https://hashnode.com/posts/build-rest-api-with-nodejs-upload-files-mongodb/5f2cb59d3b12e25afe3e42df/comment/6019606f58cc670f3df464e5)

Hi [Victoria Lo](https://hashnode.com/@victoria) , Awesome tutorial.Its really very good tut. I have problem while using image upload from postman. Only when i use form-data method 'post' in POSTMAN i'm getting error while using image type file. Getting this error name": "ValidatorError", "message": "Path `name` is required.". But all the pervious code with out image is working fine with raw data with json data type. I try to debuge it .It happens only when i use form-data then in code req.body.name is not working but while using raw data using json its working. Should i need to use this

```
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: false }))

app.use(bodyParser.json())
```

![Screenshot from 2021-02-02 19-52-51.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1612275806337/b_5lSpLBS.png) Can you please help me upload image using form-data using POSTMAN ?

[Victoria Lo](https://hashnode.com/@victoria)

[Feb 2, 2021](https://hashnode.com/posts/build-rest-api-with-nodejs-upload-files-mongodb/5f2cb59d3b12e25afe3e42df/comment/6019606f58cc670f3df464e5#reply-60196c1d58cc670f3df465dc)

Hi Sidharth, please check your routes carefully and make sure it's just `/tea` and POSTman is not expecting a `/tea/:name`, which may cause the error.

Another possibility is that the `image` property in the `newTea` function is still `req.body.image`. Please update it to `req.file.path` like so (if you haven't):

```
const newTea = new Tea({
     name:req.body.name,
     image: req.file.path,  //update this
     description: req.body.description,
     keywords: req.body.keywords,
     origin: req.body.origin,
     brew_time: req.body.brew_time,
     temperature: req.body.temperature,
})
```

[Sidharth Kumar](https://hashnode.com/@Sidk)

[Feb 2, 2021](https://hashnode.com/posts/build-rest-api-with-nodejs-upload-files-mongodb/5f2cb59d3b12e25afe3e42df/comment/6019606f58cc670f3df464e5#reply-60196fe158cc670f3df4660c)

Hi [Victoria Lo](https://hashnode.com/@victoria),

Its working. Thanks a lot, Simple error on my side on routes. The way you explain the tutorial is amazing. Thanks once again for your support.

[Victoria Lo](https://hashnode.com/@victoria)

[Feb 2, 2021](https://hashnode.com/posts/build-rest-api-with-nodejs-upload-files-mongodb/5f2cb59d3b12e25afe3e42df/comment/6019606f58cc670f3df464e5#reply-601972fb0394d00f62dc4827)

Glad it's all good now [Sidharth Kumar](https://hashnode.com/@Sidk)! Feel free to ask any questions if there's anything you're unsure of.

Thanks for reading and following along the series! Hope you'll get to build your own amazing API after this :)
