Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何在BLUMP文件上传ExjJS中考虑不同服务的不同选项_Node.js_Web Services - Fatal编程技术网

Node.js 如何在BLUMP文件上传ExjJS中考虑不同服务的不同选项

Node.js 如何在BLUMP文件上传ExjJS中考虑不同服务的不同选项,node.js,web-services,Node.js,Web Services,这是我代码的一部分: var options1 = { tmpDir: __dirname + '/private/uploaded/tmp', uploadDir: __dirname + '/private/uploaded/files', uploadUrl: '/uploaded/files/', // // ////rest of the options }; var options2 = { tmpDir: __dirname + '/../pingov

这是我代码的一部分:

var options1 = {
  tmpDir: __dirname + '/private/uploaded/tmp',
  uploadDir: __dirname + '/private/uploaded/files',
  uploadUrl: '/uploaded/files/',
  //
  //
  ////rest of the options
};

var options2 = {
  tmpDir: __dirname + '/../pingova/uploads/tmp',
  uploadDir: __dirname + '/../pingova/uploads/images',
  uploadUrl: '/../pingova/uploads/',
  //
  //
  //rest of the parameters
};

// inti the module
var moduleRequried = require('blueimp-file-upload-expressjs');

// init the uploader2
var uploader2 = moduleRequried(options1);

// init the uploader2
var uploader2 = moduleRequried(options2);

app.post('/upload-image', function(req, res) {
  uploader1.post(req, res, function(error, obj, redirect) {
    //here I am using uploader1
  });

});


app.post('/upload-profile-pic', function(req, res) {
  uploader2.post(req, res, function(error, obj, redirect) {
    //here I am using uploader2
  });

});
代码的问题是: 尽管我创建了单独的选项并对其进行了初始化,但它将图像存储在选项2
我不明白如何提供不同的选择。我需要不同的选项将图像存储在两个不同的文件位置

我解决了它。我不知道这是不是正确的方法。我将//init放入uploader2var uploader2=moduleRequried(选项1);但是我觉得上面我接受的方式不太可靠。所以如果有人有其他的解决方案,请提出来