javascript - ExpressJS Multer File Persmission -


var express = require('express'); var app = express(); var fs = require("fs");  var bodyparser = require('body-parser'); var multer  = require('multer');  app.use(express.static('public')); app.use(bodyparser.urlencoded({ extended: false })); app.use(multer({ dest: '/new/'})); 

this starting of file. showing below message during startup server

/usr/lib/node_modules/multer/node_modules/mkdirp/index.js:90 throw err0; ^ error: eacces, permission denied '/new' @ object.fs.mkdirsync (fs.js:654:18) @ function.sync (/usr/lib/node_modules/multer/node_modules/mkdirp/index.js:71:13) @ new diskstorage (/usr/lib/node_modules/multer/storage/disk.js:21:12) @ module.exports (/usr/lib/node_modules/multer/storage/disk.js:65:10) @ new multer (/usr/lib/node_modules/multer/index.js:15:20) @ multer (/usr/lib/node_modules/multer/index.js:75:12) @ object. (/var/www/node/server.js:10:9) @ module._compile (module.js:456:26) @ object.module._extensions..js (module.js:474:10) @ module.load (module.js:356:32)

please let me if can me prevent problem. thank much.

multer trying create destination folder /new in global node_modules location. change path local destination. try following

app.use(multer({ dest: './new/'})); 

if getting error above try

app.use(multer({ dest: __dirname +'/new/'})); 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -