Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.post('/remove-image', (req, res)=>{
  2.  
  3.     const imageTitle = req.body.imageTitle;
  4.     const userid = req.body.userid;
  5.  
  6.     const fileMain = './public/media/'+userid+'/'+imageTitle;
  7.  
  8.     fs.exists(fileMain, function(exists) {
  9.  
  10.         if(exists) {
  11.  
  12.             fs.unlink(fileMain);
  13.            
  14.         }
  15.  
  16.     });
  17.  
  18.     return res.json({
  19.         access:'ok'
  20.     })
  21.  
  22. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement