Node入门中上传文件问题de处理方法
发布于 2年前 作者 jsczjt2013 1631 次浏览

http://www.nodebeginner.org/index-zh-cn.html

this.uploadDir = opts.uploadDir || os.tmpDir(); ^ TypeError: Object #<Object> has no method ‘tmpDir’ at new IncomingForm (/home/nodejs/node_modules/formidable/lib/incoming_form.js:28:41) at Object.upload [as /upload] (/home/nodejs/test/requestHandlers.js:30:14) at route (/home/nodejs/test/router.js:4:20) at Server.onRequest (/home/nodejs/test/server.js:8:5) at Server.emit (events.js:70:17) at HTTPParser.onIncoming (http.js:1479:12) at HTTPParser.onHeadersComplete (http.js:102:31) at Socket.ondata (http.js:1375:22) at TCP.onread (net.js:334:27)

原因是因为os.js中没有对应的tmpDir这个function 修改incoming_form.js可以暂时处理这个问题 this.uploadDir = opts.uploadDir || "/tmp";

回到顶部