{"action":"closed","issue":{"url":"https://api.github.com/repos/douzi8/upload-file/issues/2","repository_url":"https://api.github.com/repos/douzi8/upload-file","labels_url":"https://api.github.com/repos/douzi8/upload-file/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/douzi8/upload-file/issues/2/comments","events_url":"https://api.github.com/repos/douzi8/upload-file/issues/2/events","html_url":"https://github.com/douzi8/upload-file/issues/2","id":166846565,"number":2,"title":"Using upload-file in Meteor is throwing up an error.","user":{"login":"vijayst","id":3457565,"avatar_url":"https://avatars.githubusercontent.com/u/3457565?v=3","gravatar_id":"","url":"https://api.github.com/users/vijayst","html_url":"https://github.com/vijayst","followers_url":"https://api.github.com/users/vijayst/followers","following_url":"https://api.github.com/users/vijayst/following{/other_user}","gists_url":"https://api.github.com/users/vijayst/gists{/gist_id}","starred_url":"https://api.github.com/users/vijayst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vijayst/subscriptions","organizations_url":"https://api.github.com/users/vijayst/orgs","repos_url":"https://api.github.com/users/vijayst/repos","events_url":"https://api.github.com/users/vijayst/events{/privacy}","received_events_url":"https://api.github.com/users/vijayst/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-21T15:21:04Z","updated_at":"2016-07-21T15:38:47Z","closed_at":"2016-07-21T15:38:47Z","body":"```\r\n`WebApp.connectHandlers.use('/upload', (req, res) => {\r\n      const upload = new Upload({\r\n        dest: './docs',\r\n        maxFileSize: 100 * 1024,\r\n        acceptFileTypes: /(\\.|\\/)(gif|jpe?g|png)$/i,\r\n        rename(name, file) {\r\n          console.log(this.fields);\r\n          return file.filename;\r\n        },\r\n      });\r\n\r\n```\r\n      upload.on('end', (fields, files) => {\r\n        if (!fields.channel) {\r\n          this.cleanup();\r\n          this.error('Channel can not be empty');\r\n          return;\r\n        }\r\n        console.log(files);\r\n        res.writeHead(200);\r\n        res.write('ok');\r\n        res.end();\r\n      });\r\n\r\n      upload.on('error', (err) => {\r\n        console.log(err);\r\n        res.writeHead(500);\r\n        res.write(err);\r\n        res.end();\r\n      });\r\n\r\n      upload.parse(req);\r\n    });`\r\n\r\nIn Meteor, connect middleware is used. The error that is being thrown is below:\r\nChannel can not be empty\r\n\r\n**Do I need to use body-parser or some parser with the connect for upload-file to work?**"}}
{"actor":{"display_login":"vijayst"}}