Created
February 22, 2013 06:44
-
-
Save dileephell/5011281 to your computer and use it in GitHub Desktop.
This file contains 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 tmp_path = req.files.uploadimgs.path; | |
// set where the file should actually exists - in this case it is in the "images" directory | |
var target_path = './upload/work/' + req.files.uploadimgs.name; | |
// move the file from the temporary location to the intended location | |
fs.rename(tmp_path, target_path, function(err) { | |
if (err) throw err; | |
console.log('cfgh'); | |
// delete the temporary file, so that the explicitly set temporary upload dir does not get filled with unwanted files | |
fs.unlink(tmp_path, function() { | |
if (err) throw err; | |
console.log('fdsggghggff'); | |
res.send('File uploaded to: ' + target_path + ' - ' + req.files.uploadimgs.size + ' bytes'); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment