function uploadfiles(res, req){ var form = new formidable.IncomingForm(); form.parse(req,function(error, fields, files){ var types = files.upload.name.split('.'); var date = new Date(); var ms = Date.parse(date); fs.renameSync(files.upload.path,"/tmp/files"+ ms +"."+String(types[types.length-1])); }); }