Bug in documentation of Dynamic upload dir
Opened this issue · 10 comments
Shoulnd't you add a next()
at the end of the configuration?
app.use('/upload', function (req, res, next) {
// imageVersions are taken from upload.configure()
upload.fileHandler({
uploadDir: function () {
return __dirname + '/public/uploads/' + req.sessionID
},
uploadUrl: function () {
return '/uploads/' + req.sessionID
}
})(req, res, next);
// This is the added Code
next();
});
Actually, upload.fileHandler is expected to be the only request handler, so no need for next()
Btw, I just tried using the exact same code, but it turned out not to work at all as expected: files were simply not uploaded :(
Does it have to do with where this piece of code is put in the configure function?
Cheers!
No errors at all ?
no not really !
Please let me know whether you're still in trouble
Well, I haven't done anything new since, but last time i used the exact code in the documentation, the files were not being uploaded.
are you on linux or windows ? have you configured tmpDir correctly ?
mac :P
Well here's how I configured it:
upload.configure
uploadDir: path.join(__dirname, "/tmp/uploads")
What is in uploadPath ? What happens when you try to upload ? Does the file appear in the __dirname + "/tmp/uploads" ? Have you checked with chrome dev console what server returns ?
Sorry for the delay mate, I won't be working on this till next week. i'll try to give a better debug log :)