{"action":"created","issue":{"url":"https://api.github.com/repos/expressjs/multer/issues/178","labels_url":"https://api.github.com/repos/expressjs/multer/issues/178/labels{/name}","comments_url":"https://api.github.com/repos/expressjs/multer/issues/178/comments","events_url":"https://api.github.com/repos/expressjs/multer/issues/178/events","html_url":"https://github.com/expressjs/multer/issues/178","id":97004287,"number":178,"title":"Multiple files are not uploading","user":{"login":"GopalakrishnanK","id":10287362,"avatar_url":"https://avatars.githubusercontent.com/u/10287362?v=3","gravatar_id":"","url":"https://api.github.com/users/GopalakrishnanK","html_url":"https://github.com/GopalakrishnanK","followers_url":"https://api.github.com/users/GopalakrishnanK/followers","following_url":"https://api.github.com/users/GopalakrishnanK/following{/other_user}","gists_url":"https://api.github.com/users/GopalakrishnanK/gists{/gist_id}","starred_url":"https://api.github.com/users/GopalakrishnanK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GopalakrishnanK/subscriptions","organizations_url":"https://api.github.com/users/GopalakrishnanK/orgs","repos_url":"https://api.github.com/users/GopalakrishnanK/repos","events_url":"https://api.github.com/users/GopalakrishnanK/events{/privacy}","received_events_url":"https://api.github.com/users/GopalakrishnanK/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-24T08:39:03Z","updated_at":"2015-07-24T08:53:30Z","closed_at":"2015-07-24T08:53:30Z","body":"Hi, \r\n\r\nI am trying to upload multiple images using multer. but when i try i get this error. \r\n\r\n![wer](https://cloud.githubusercontent.com/assets/10287362/8870626/04018284-320d-11e5-8502-5eb11eaad71e.PNG)\r\n\r\nwhats my problem.........?\r\nhere's my code,\r\n\r\nHTML:::\r\n![ert](https://cloud.githubusercontent.com/assets/10287362/8870768/0dd42c3e-320e-11e5-9acc-3b462c6920cb.PNG)\r\n\r\nJquery:::\r\n\r\n![dfg](https://cloud.githubusercontent.com/assets/10287362/8870814/63c35d90-320e-11e5-96e8-c7420cedb6f8.PNG)\r\n\r\nNODE JS:::\r\n```javascript\r\n// Custom Storage\r\nvar multi = multer.diskStorage({\r\n  destination: function (req, file, cb) {\r\n    cb(null, './files/uploads/products/temp/')\r\n  },\r\n  filename: function (req, file, cb) {\r\n    crypto.pseudoRandomBytes(16, function (err, raw) {\r\n      cb(null, raw.toString('hex') + Date.now() + '.' + mime.extension(file.mimetype));\r\n    });\r\n  }\r\n});\r\n\r\n// multer variable\r\nvar tempImageUpload = multer({storage : multi}).array('photos',4);\r\n\r\n// upload function\r\nexports.tempUp = function(req, res) {\r\n\ttempImageUpload(req, res, function (err) {\r\n\t\tconsole.log(req.files);\r\n        if (!err) {\r\n            console.log(\"Image Uploaded\");\r\n            res.json({status: 1, error: \"\", message: \"Images Uploaded\"});  \r\n        } else {\r\n            console.log(err.message);\r\n            res.json({status: 0, error: err.message, message: \"file upload failed\"});  \r\n        }\r\n    });\r\n}\r\n```\r\n\r\nThanks in advance................"},"comment":{"url":"https://api.github.com/repos/expressjs/multer/issues/comments/124447201","html_url":"https://github.com/expressjs/multer/issues/178#issuecomment-124447201","issue_url":"https://api.github.com/repos/expressjs/multer/issues/178","id":124447201,"user":{"login":"LinusU","id":189580,"avatar_url":"https://avatars.githubusercontent.com/u/189580?v=3","gravatar_id":"","url":"https://api.github.com/users/LinusU","html_url":"https://github.com/LinusU","followers_url":"https://api.github.com/users/LinusU/followers","following_url":"https://api.github.com/users/LinusU/following{/other_user}","gists_url":"https://api.github.com/users/LinusU/gists{/gist_id}","starred_url":"https://api.github.com/users/LinusU/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LinusU/subscriptions","organizations_url":"https://api.github.com/users/LinusU/orgs","repos_url":"https://api.github.com/users/LinusU/repos","events_url":"https://api.github.com/users/LinusU/events{/privacy}","received_events_url":"https://api.github.com/users/LinusU/received_events","type":"User","site_admin":false},"created_at":"2015-07-24T08:53:30Z","updated_at":"2015-07-24T08:53:30Z","body":"You Node.js code is expecting the fieldname to be `photos` for all the files. You jQuery code is sending them as `\"file\" + file`.\r\n\r\nChange your `formData.append` line to read like this:\r\n\r\n```javascript\r\nformData.append('photos', this)\r\n```\r\n\r\nP.s. please post the actual code as text instead of images, it makes it much easier for me to suggest edits to it. [Read this](https://help.github.com/articles/github-flavored-markdown/#syntax-highlighting) to get the syntax highlighting working."}}