Skip to content

Instantly share code, notes, and snippets.

@ntanya
Created Jun 7, 2012
Embed
What would you like to do?
upload
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