Created
November 28, 2011 17:27
-
-
Save arifsetiawan/1401194 to your computer and use it in GitHub Desktop.
upload form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
// express setup | |
var app = express.createServer(); | |
app.use(express.bodyParser()); | |
app.get('/', function(req, res){ | |
res.writeHead(200, {'content-type': 'text/html'}); | |
res.end( | |
'<form action="/upload" enctype="multipart/form-data" method="post">'+ | |
'<input type="text" name="title"><br>'+ | |
'<input type="file" name="upload" multiple="multiple"><br>'+ | |
'<input type="submit" value="Upload">'+ | |
'</form>' | |
); | |
}); | |
app.post('/upload', function(req, res){ | |
console.log('upload ' + JSON.stringify(req.body)); | |
res.send('post photo'); | |
}); | |
app.listen(process.env.PORT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment