Created
June 7, 2012 17:52
-
-
Save ntanya/2890392 to your computer and use it in GitHub Desktop.
upload
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
app.post('/', function(req, res){ | |
var temp_path = req.files.uploadfile.path; | |
var save_path = './public/images/' + req.files.uploadfile.name; | |
fs.rename(temp_path, save_path, function(error){ | |
if(error) throw error; | |
fs.unlink(temp_path, function(){ | |
if(error) throw error; | |
res.send("File uploaded to: " + save_path); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment