我可以设置文件上传路径到/fileupload1
文件夹,但是如何设置文件上传路径到/fileupload2
文件夹?感谢
myapp
/config
config.js
express.js
/fileupload1
/public
/fileupload2
server.js
在server.js
:
var express = require('express'),
fs = require('fs'),
var app = express(),
app.use(express.static(__dirname + '/public'));
exports = module.exports = app;
在express.js
:
var express = require('express'),
module.exports = function(app, config) {
app.use(express.static(config.root + '/public'));
app.use(express.bodyParser({ keepExtensions: true, uploadDir: __dirname + "/fileupload1" }))
};
答案 0 :(得分:0)
试试这个:
express.bodyParser({
keepExtensions: true,
uploadDir : __dirname + "/../public/fileupload2"
})