Home » Android » android – Open uploaded photos on server node.server-Exceptionshub

android – Open uploaded photos on server node.server-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

Hi I created a chat application with Android and Socket and I used the following code for uploading photos to Android and Socket but when I want to open uploaded photos from inside the server I use the link inside browser and Android with Error I’m facing below
Thank you if you can help

Error: Cannot GET /uploaded_file-1581317880464

var storage = multer.diskStorage({
    destination: function (req, file, cb) {
      cb(null, __dirname+'/uploads/')
    },
    filename: function (req, file, cb) {
        var picname=file.fieldname + '-' + Date.now()+'.jpg';
      cb(null,picname )
      console.log("esfesf",picname)
      console.log("ffcsdfs",lastid);

    }
  })

  var upload = multer({ storage: storage })

  //passing multer as middleware
  app.post('/profile',upload.any(), function(req, res) {
    res.contentType('image/jpeg');

     console.log("rge",req.body)
How to&Answers: