(Multipart) zip upload in ruby webmachine handled by rack
<p>I'm making an upload form for zips in a ruby webmachine app. My idea is to have an upload through my backend where I can add some extra params and then upload it to amazons s3 service with RestClient. </p>

<p>I did successfully create a direct upload (web based form post) to a s3bucket, but in that way I'm unable to handle the variables which are needed in the request, the way I want. </p>

<p>I've tried several things but I can't figure out, how to handle the request, as soon as it gets in my backend. I've created a resource and I'm debugging directly in the <code>process_post</code> method. </p>

<p>My <code>@request</code> variable represents a <code>Webmachine::Request</code>, with a <code>Webmachine::Adapters::Rack::RequestBody</code> and a <code>Rack::Request</code>, but I can't get the file out of it to use it as input for my RestClient request. </p>

<p>I think; <code>@request.body.to_s</code> and <code>@request.body.to_io</code>, represent the uploaded file in some way, and I tried to use them as input for <code>Rack::Multipart</code> methods, but that doesn't give me the file. </p>

<p>I also tried to work with the rack-raw-upload gem, but I can't get the mime-type something else than "application/x-www-form-urlencoded" or multipart. I do explicitly set it to; <code>application/octet-stream</code></p>

<p>Things like <code>File.new(filename, 'rb')</code> gave me `rrno::ENOENT: No such file or directory @ rb_sysopen'. For filename I just used 'example.zip'.</p>

<p>I guess I'm missing something which has to do with the Rack::Request call(env) method. </p>

<p>Does somebody have an idea, on how to handle the Rack uploads? Or give me any hints for a new direction? Thanks. </p>