Friday, 14 April 2017

Nodejs express error upload file debian vps

all! I'm trying to upload file to nodejs server. I use multer.

const multer  = require('multer'); const UPLOAD_PATH = 'uploads'; 
const upload = multer({ dest: `${UPLOAD_PATH}/` }); const
 sericesApi=(app)=> {
     app.post('/api/upload', upload.single('avatar'), (req, res) => {
         try {
             res.send({'file':req.file});
         } catch (err) {
             res.sendStatus(400);
         }
    }); }

On my localhost(Ubuntu 16.04) all is good, but on VPS - Debian GNU/Linux 8.7 (jessie) I get ERR_CONNECTION_REFUSED or ERR_EMPTY_RESPONSE. I've tried to use: multer, busboy, express-fileupload. All wasn't work



via Alex Balandin

No comments:

Post a Comment