title: saving a file (from stream) to disk using c#
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/411592/how-do-i-save-a-stream-to-a-file">How do I save a stream to a file?</a>  </p>
  </blockquote>
  
  
  
  <p>I have got a stream object which may be an image or file (msword, pdf), I have decided to handle both types very differently, as I may want to optimize/ compress / resize / produce thumbnails etc. I call a specific method to save an image to disk, the code:</p>
  
  <pre><code>var file = StreamObject;
  
  //if content-type == jpeg, png, bmp do...
      Image _image = Image.FromStream(file);
      _image.Save(path);
  
  //if pdf, word do...
  </code></pre>
  
  <p>How do I actually save word and pdfs?</p>
  
  <pre><code>//multimedia/ video?
  </code></pre>
  
  <p>I have looked (not hard enough probably) but I could not find it anywhere...</p>