0

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

1 回答 1

0

尝试这个:

express.bodyParser({
  keepExtensions: true,
  uploadDir     : __dirname + "/../public/fileupload2"
})
于 2013-11-06T06:51:12.020 回答