我对这段代码有一个重要的问题
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 使用强大的模块......但我想调用方法。('fileBegin'......用快递,我不能
方法在哪里...对象形式在哪里
如您所见,对象表单具有字段和文件
在 express.bodyParser 文件在 req.files 和字段在 req.body 但是当我尝试调用 req.on('fileBegin'... 给我一个错误
有人试试这个???