上传文件报405错误,提示Method Not Allowed,请问各位高手该怎么解决呢?
2 回复
服务器端已经写了处理的代码,为什么提示方法不允许?
module.exports = {
uploadcsv: function *(next) {
console.log('进入上传文件');
console.log('this.method:' + this.method);
if ('POST' != this.method) {
return yield next;
}
var parts = parse(this),
part;
while (part = yield parts) {
console.log('进入循环');
console.log('part:' + part);
var stream = fs.createWriteStream('/tmp/' + Math.random());
part.pipe(stream);
console.log('uploading %s -> %s', part.filename, stream.path);
}
this.redirect('/detailbase');
}
}