"Untitled"
Bootstrap 4.1.1 Snippet by Arjunverma

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Add multiple image array in database</h2> </div> </div>
let data = await Model.Product(req.body) let textToDots = '...' let productImg = [] if (data) { let shortText = data.desc.substring(0, 100) + textToDots Object.assign(data, { excerptText: shortText }) if (req.files.length > 0) { for (let i = 0; i < req.files.length; i++) { let imgPaths = req.files[i].path; productImg.push({ imageUrl: imgPaths }) } } data.productImg = productImg; } let result = await data.save() res.send(result);

Related: See More


Questions / Comments: