Uploading files with express.js is insanely simple!
FYI, there's something special called req.files when you upload multipart forms. In this case I upload the file with a form field with the name of "file".
I found this stuff out here:
https://groups.google.com/forum/#!topic/express-js/vDmtdWMx5tY
Nice post man, I used it today:D
ReplyDeleteThanks for this. One question you might be able to handle: bodyParser seems to handle the file upload even if I have not defined a route for the url, using app.post() for example. Adding a request handler using app.post() seems optional. Question is: how do I prevent anonymous users from posting to any URL and uploading files? Is there way to only activate bodyParser on urls I specify? Thanks.
ReplyDelete