このコードに関する重要な質問があります
form
.on('error', function(err) {
throw err;
})
.on('field', function(field, value) {
//receive form fields here
})
/* this is where the renaming happens */
.on ('fileBegin', function(name, file){
//rename the incoming file to the file's name
file.path = form.uploadDir + "/" + file.name;
})
.on('file', function(field, file) {
//On file received
})
.on('progress', function(bytesReceived, bytesExpected) {
//self.emit('progess', bytesReceived, bytesExpected)
var percent = (bytesReceived / bytesExpected * 100) | 0;
process.stdout.write('Uploading: %' + percent + '\r');
})
これらは手ごわいモジュールのメソッドです... Express.bodyParser が手ごわいモジュールを使用していることを発見しました... しかし、メソッド on.('fileBegin'... を Express で呼び出したいのですが、できません
メソッドはどこですか... オブジェクトフォームはどこですか
ご覧のとおり、オブジェクトフォームにはフィールドとファイルがあります
express.bodyParser では、ファイルは req.files にあり、フィールドは req.body にありますが、 req.on('fileBegin'... を呼び出そうとすると、エラーが発生します
誰かこれを試してみてください???