I have bean searching the Internet on how to upload a file to a web server from nodejs. I found some stuff but it told you how to upload to a nodejs server and not some other web server. So my qutions is how can I upload a file using nodejs to a web serve?
Use the http module and pipe a file stream to the request.
var req = http.request(options, function(res) {
});
req.on('error', function(err) {
throw err;
});
fs.createReadStream(file).pipe(req);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.