我可以设置文件夹的文件上传路径/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" }))
};