Sha256: dd867a2e5c153fdcc1a6df18247546c38501a7948fff707e1919b0285be91220
Contents?: true
Size: 717 Bytes
Versions: 17
Compression:
Stored size: 717 Bytes
Contents
/** * Module dependencies. */ var connect = require('../'); connect() .use(connect.bodyParser()) .use(form) .use(upload) .listen(3000); function form(req, res, next) { if ('GET' !== req.method) return next(); res.setHeader('Content-Type', 'text/html'); res.end('<form method="post" enctype="multipart/form-data">' + '<input type="file" name="images" multiple="multiple" />' + '<input type="submit" value="Upload" />' + '</form>'); } function upload(req, res, next) { if ('POST' !== req.method) return next(); req.files.images.forEach(function(file){ console.log(' uploaded : %s %skb : %s', file.originalFilename, file.size / 1024 | 0, file.path); }); res.end('Thanks'); }
Version data entries
17 entries across 17 versions & 2 rubygems