fileup-node

File upload helper for Nodejs/Express

###fileup-node
File upload helper for nodejs/express

Install

$ npm install fileup-node

#####POST your file to /doupl

###Upload using HTML

<form method="post" enctype="multipart/form-data" action="/doupl">
    <input type="file" name="myfile">
    <input type="submit">
</form>
$ curl -F myfile=@<filename> localhost/doupl

This can be used for other web servers, that support app.post(req, res)

var express = require('express'), app = express();
app.use(express.bodyParser());
 
require('./fileup-node.js')('./testdir', app, function(r, s){
    // after file has been uploaded and saved
    s.end(r.files.myfile.name + ' has been uploaded');
})
 
app.get('/', function(r, s){
    s.setHeader('Content-Type', 'text/html');
    s.end('\
        <form method="post" enctype="multipart/form-data" action="/doupl">\
            <input type="file" name="myfile">\
            <input type="submit">\
        </form>');
})
 
app.listen(80);