Last active
December 31, 2015 03:19
-
-
Save anttti/7926388 to your computer and use it in GitHub Desktop.
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
const | |
fs = require('fs'), | |
path = require('path'), | |
express = require('express'), | |
app = express(); | |
app.use(express.bodyParser({ uploadDir:'./uploads' })); | |
app.post('/', function(req, res) { | |
var targetPath = path.resolve('./uploads/' + req.files.uploadedFile.name); | |
fs.rename(req.files.uploadedFile.path, targetPath, function(err) { | |
if (err) throw err; | |
res.end('Upload completed!'); | |
}); | |
}); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment