Below is the html for file upload

```html
<div class="form-group" >
  <label for="Image">Image</label>
  <input type="file" name="image"  value="<%=fillData.image%>"  id="inpFile" class="form-control"placeholder="drop an image " /><br>
  <div class="image-preview" style="text-align: center;">
    <img src="" id="imgPreview" alt="imagePreview"/>
  </div>
</div>

```

The server side code for handling the image uplaod in NodeJS using `fileupload` module

```js
router.post("/addProduct",(req,res)=>{
  const nimage = req.files.image.name
  const Price = parseFloat(req.body.price).toFixed(2)
  console.log(req.files.image)
  const nProduct = new Products({
    title:req.body.title,
    slug:req.body.slug,
    desc :req.body.description,
    category:req.body.category,
    price:Price,
    image:nimage
  })
  nProduct.save().then((value) => {
    mkdirp("public/product_images/"+nProduct._id).then(made=>{
      console.log(`file created starting with on id ${made}`)
    })
    mkdirp("public/product_images/"+nProduct._id+"/gallery").then(made=>{
      console.log(`file created starting with id and gallery  ${made}`)
    })
    mkdirp("public/product_images/"+nProduct._id+"/gallery/thumbs").then(made=>{
      console.log(`file created starting with  and thumbs${made}`)
    })
    if(nimage!=""){
      console.log("hello")
      const productImage = req.files.image
      const path = "public/product_images/"+nProduct._id+"/"+nimage;
      console.log(path)
      productImage.mv(path, function(err){
        return console.log(err)
      })
    }
  })
}

```

Getting the following error

> 
> [Error: ENOENT: no such file or directory, open 'D:\NodeE\public\product\_images\5ff718bebe310d2f3c34590a\noimage.jpg'] {
> errno: -4058,
> code: 'ENOENT',
> syscall: 'open',
> path: 'D:\NodeE\public\product\_images\5ff718bebe310d2f3c34590a\noimage.jpg'
> }
> 
> 
>