title: Request.post on already uploaded image file
body: <p>I am using Angularjs and nodejs in the project and working on file uploads. I want to send the post request to the url endpoint in a secure way as I need to attach accesstoken with the request. So the way I did this was, I added the directive to choose the file from UI and once it gets the file, I append it using FormData() like this in the controller</p>
  
  <pre><code>var fd = new FormData();
  fd.append('file',myFile);
  </code></pre>
  
  <p>and sending this formdata object to the nodejs server like mentioned here <a href="http://uncorkedstudios.com/blog/multipartformdata-file-upload-with-angularjs" rel="nofollow">http://uncorkedstudios.com/blog/multipartformdata-file-upload-with-angularjs</a></p>
  
  <p>expect this request will be going to my nodejs server url from there I will be making another post request to external web service </p>
  
  <pre><code>$http.post('api/collections/upload',fd, {
        transformRequest: angular.identity,
        headers: {
          'Content-type': undefined
       }
  });
  </code></pre>
  
  <p>So it will attach the right content-type and boundaries in the request. I am getting the file on server side nodejs when I do</p>
  
  <pre><code>function(req,res){
    console.log(req.files); //I am able to see the file content
  }
  </code></pre>
  
  <p>It is uploaded on the nodejs server side. 
  Now I want to make a post request using the req.files to a different endpoint along with proper accessToken and headers. Tried many things but not able to make the request go thru. Not sure how can I attach the imagedata/ req.files along with the request. I tried these two things mentioned in request npm module <a href="https://www.npmjs.org/package/request" rel="nofollow">https://www.npmjs.org/package/request</a></p>
  
  <p>1)     </p>
  
  <pre><code>request.post({
      url: 'https://www.example.com/uploadImage',
      headers: {
        'Authorization': &lt;accessToken&gt;,
        'Content-type': 'multipart/form-data'
      },
      body: req.files
   });
  </code></pre>
  
  <p>Don't know how can I attach and binary data with this request and how can I put boundary. Is boundary needed when you want to send the uploaded image with this request? </p>
  
  <p>2)</p>
  
  <pre><code>fs.createReadStream(req.files.file.path, {encoding: base64}).pipe(request.post({
      url: 'https://www.example.com/uploadImage',
      headers: {
       'Content-type': 'multipart/form-data'
      }
    })); 
  </code></pre>
  
  <p>Can someone please suggest some ideas on how can I send this post request using request npm module? Thanks.</p>