Skip to content

Instantly share code, notes, and snippets.

Created February 10, 2014 11:50
Show Gist options
  • Save anonymous/8914502 to your computer and use it in GitHub Desktop.
Save anonymous/8914502 to your computer and use it in GitHub Desktop.
app.post(/^\/mobiles\/.*/, function (req, res) {
var postUrl = "https://d3v0fbs.net" + req.url;
console.log(req.body, req.files.imageupload.path);
var form = req.body
if (req.files && req.files.imageupload)
form.pipe(fs.createWriteStream(__dirname + req.files.imageupload.path))
request.post({url:postUrl, form: form}, function (err, r, body) {
if (err) {
console.log(err);
} else {
console.log(body);
res.json(JSON.parse(body));
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment