title: Rails/Ruby: uploading a binary File and writing it with a File-Object
body: <p>I need to upload Word and Excel files on my site.</p>
  
  <p>I create a upload form, upload the file and save it like this:</p>
  
  <pre><code>f = File.new("public/files/#{user.id.to_s}/filename", "w+")
  f.write params[:file].read
  f.close
  </code></pre>
  
  <p>Word and Excel files must be saved as binary data.</p>
  
  <p>Sadly the Filemode "b" is only for windows and I'm under linux.</p>
  
  <p>What to do?</p>
  
  <p>Yours,</p>
  
  <p>Joern</p>