:どの入力が特定のopnedファイルを大量に送信するのかをどのように知ることができますか?この質問の後
How set a function into limits parameters on multer?
それが答えを受けていないことを、私は代替を探していると私は手ごわい見ています。 私は別のチュートリアルを発見し、今私はこのコードを持っている:私は、コードの最初の部分でファイルを反復処理する場合、私は[{input_file1:{ファイルの属性}}のようないくつかのことを受け、今
exports.formidable= function (req, res, cb){ var form = new formidable.IncomingForm(); form.multiples = true; form.parse(req, function(err, fields, files) { res.end(util.inspect({fields: fields, files: files})); });
form.on('end', function(fields, files) {
for(var i = 0; i < this.openedFiles.length; i++) { /* Temporary location of our uploaded file / var temp_path = this.openedFiles[i].path; / The file name of the uploaded file / var file_name =Date.now()+"-"+ this.openedFiles[i].name; / Location where we want to copy the uploaded file */ var new_location = './files/';
fs.move(temp_path, new_location + file_name, function (err) { if (err) { console.error(err); } else { console.log("success!") } }); } }); return;
};
を、 {input_file2:{ファイルの属性}}]
とopenedFilesを反復: [{0:{ファイルの属性}、 {1:ファイルの属性}}]次に
、Iが一定であることができる両オブジェクトであります同じ順序で? 答えが、私が推測するように、2番目のオブジェクトから入力名を取り出すことはできますか? 不可能な場合は、回避策がありますか?
ありがとうございました!