Dickyperdian's avatar

problem upload image usage cloudinary, express js in vultr server

hello i need help, i have a problem

 Error: ENOENT: no such file or directory, open 

before, i try upload image in localhost, and working, but When you try to directly on the server, the image cannot be uploaded with the error message "Error: ENOENT: no such file or directory, open " \

my script

//router
router.post('/post-aspirasi', multipartMiddleware, function(req, res) {
  axios.post(urlPostAspirasi, {
    thumbnail_url: req.files.thumbnail_url,
    content_option: req.body.content_option
  },{ headers: { Authorization: req.session.token } })
  .then((response) => {
    res.redirect('/')
  })
  .catch((error) => {
    console.log(error)
  })
})


/////API
//router
router.post('/post',multipartMiddleware, authentication, async(function(req, res, next) {
  const response = await(postAspirasi(req.body))
  return res.json(response)
}))

//models

exports.postAspirasi = async((data) => {
    cloudinary.uploader.upload(data.thumbnail_url.path, ((image, err ) => {
    console.log(image.secure_url) 
    }))
      
})

thanks before

0 likes
1 reply
Dickyperdian's avatar

Remember, in local, working. then i upload to server , and not working

Please or to participate in this conversation.