title: Ruby Multi-part Form Upload with RestClient
body: <p>I'm working on a ruby application, and am trying to upload a file to box.net.  I have it working with the curl call</p>
  
  <pre><code>curl https://www.box.com/api/2.0/files/data -H "Authorization: BoxAuth api_key=&lt;API_KEY&gt;&amp;auth_token=&lt;AUTH_TOKEN&gt;" -F folder_id=0 -F filename=@test.txt --trace ~/Desktop/log.txt
  </code></pre>
  
  <p>I've tried to translate this into ruby, and have tried the following</p>
  
  <pre><code>request = RestClient::Request.new(:method =&gt; :post,:url =&gt; "https://www.box.com/api/2.0/files/data",:authorization =&gt; "BoxAuth api_key=&lt;API_KEY&gt;&amp;auth_token=&lt;AUTH_TOKEN&gt;",:filename =&gt; "test.txt", :payload =&gt; { :multipart =&gt; true, :file =&gt; File.new("test.txt"))
  request.execute
  </code></pre>
  
  <p>but I keep getting back a "401: Unauthorized" response.  I've also tried using the box-api gem, but that seems to only work with version 1.0 of the API, and I'm trying to interface with 2.0.</p>