Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to resend post multipart/form-data form with upload file to different server with node.js (express.js)?

I post a form with file (enctype="multipart/form-data") to node.js (express.js framework) and just want to send this same post request like it is just to different server. what is the best approach in node.js?

like image 369
vitulicny Avatar asked Feb 17 '12 11:02

vitulicny


People also ask

How do you send a file using multipart form data?

Follow this rules when creating a multipart form: Specify enctype="multipart/form-data" attribute on a form tag. Add a name attribute to a single input type="file" tag. DO NOT add a name attribute to any other input, select or textarea tags.

How do I post a picture with node js backend in multer and express?

Create a folder- images, in the root directory. const imageStorage = multer. diskStorage({ // Destination to store image destination: 'images', filename: (req, file, cb) => { cb(null, file. fieldname + '_' + Date.


1 Answers

remove express.bodyParser and try pipes like these:

req.pipe(request('http://host/url/')).pipe(res)
like image 185
IvanM Avatar answered Oct 09 '22 04:10

IvanM