UNPKG

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