{"action":"closed","issue":{"url":"https://api.github.com/repos/expressjs/multer/issues/112","labels_url":"https://api.github.com/repos/expressjs/multer/issues/112/labels{/name}","comments_url":"https://api.github.com/repos/expressjs/multer/issues/112/comments","events_url":"https://api.github.com/repos/expressjs/multer/issues/112/events","html_url":"https://github.com/expressjs/multer/issues/112","id":65156903,"number":112,"title":"changeDest throwing 'Arguments to path.join must be strings'","user":{"login":"karan-kapoor90","id":7921433,"avatar_url":"https://avatars.githubusercontent.com/u/7921433?v=3","gravatar_id":"","url":"https://api.github.com/users/karan-kapoor90","html_url":"https://github.com/karan-kapoor90","followers_url":"https://api.github.com/users/karan-kapoor90/followers","following_url":"https://api.github.com/users/karan-kapoor90/following{/other_user}","gists_url":"https://api.github.com/users/karan-kapoor90/gists{/gist_id}","starred_url":"https://api.github.com/users/karan-kapoor90/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karan-kapoor90/subscriptions","organizations_url":"https://api.github.com/users/karan-kapoor90/orgs","repos_url":"https://api.github.com/users/karan-kapoor90/repos","events_url":"https://api.github.com/users/karan-kapoor90/events{/privacy}","received_events_url":"https://api.github.com/users/karan-kapoor90/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/expressjs/multer/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/expressjs/multer/labels/ideas","name":"ideas","color":"d7e102"},{"url":"https://api.github.com/repos/expressjs/multer/labels/low%20priority","name":"low priority","color":"cfd8dc"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-30T08:04:32Z","updated_at":"2015-07-18T18:42:20Z","closed_at":"2015-07-18T18:42:20Z","body":"I attempted to use the changeDest method as follows:\r\n\r\n    changeDest:function(dest,req,resp){\r\n        \r\n        mkdirp('./uploads/'+'test/', function(err) {\r\n            if (err){\r\n                console.log('Error creating directory ',err);\r\n                //throw err;\r\n            }else {\r\n                return '/home/ubuntu/workspace/uploads/'+'test/';\r\n            }\r\n        });\r\n    \r\n\r\nas well as \r\n\r\n    changeDest:function(dest,req,resp){\r\n        \r\n        var stat = null;\r\n          try {\r\n              stat = fs.statSync('./uploads/'+'test');\r\n          } catch(err) {\r\n              console.log('folder exists checking error ',err);\r\n              // for nested folders, look at npm package \"mkdirp\"\r\n              fs.mkdirSync('./uploads/'+'test');\r\n              return './uploads/'+'test';\r\n          }\r\n          if (stat && !stat.isDirectory()) {\r\n              // Woh! This file/link/etc already exists, so isn't a directory. Can't save in it. Handle appropriately.\r\n              throw new Error('Directory cannot be created because an inode of a different type exists at \"' + dest + '\"');\r\n          }\r\n\r\nbut in either cases, the directory gets created, but I get the error message : \r\n\r\n    Arguments to path.join must be strings\r\n\r\nthe other methods right after are \r\n\r\n    onFileUploadStart:function(file,data,req,res){\r\n        console.log('onFileUploadStart');\r\n        \r\n        //console.log('****** Data ********\\n',data.body,'\\n ****** of File ******\\n',file.originalname,'\\n****************************')\r\n    },\r\n    onFileUploadComplete:function(file,req,res){\r\n        console.log('onFileUploadComplete called');\r\n        res.status(200).send({\r\n           message:'File uploaded successfully' \r\n        });\r\n    }\r\n\r\n\r\nBecause of this issue, I can't create any new directories even though I know the changeDir method is working once I create the directory structure manually before I run this."}}