1 | # connect-multiparty
|
2 |
|
3 | [connect](https://github.com/senchalabs/connect/) middleware for
|
4 | [multiparty](https://github.com/andrewrk/node-multiparty/).
|
5 |
|
6 | I actually recommend against using this module. It's cleaner to use the
|
7 | multiparty API directly.
|
8 |
|
9 | This middleware will create temp files on your server and never clean them
|
10 | up. Thus you should not add this middleware to all routes; only to the ones
|
11 | in which you want to accept uploads. And in these endpoints, be sure to
|
12 | delete all temp files, even the ones that you don't use.
|
13 |
|
14 | ## Usage
|
15 |
|
16 | ```js
|
17 | var multipart = require('connect-multiparty');
|
18 | var multipartMiddleware = multipart();
|
19 | app.post('/upload', multipartMiddleware, function(req, resp) {
|
20 | console.log(req.body, req.files);
|
21 | // don't forget to delete all req.files when done
|
22 | });
|
23 | ```
|
24 |
|
25 | If you pass options to `multipart()`, they are passed directly into
|
26 | multiparty.
|