igrigorik/em-http-request — Issue #159: Post data using multipart and streaming
Author: azisaka
Created: 2011-12-14 20:49:57+00:00
State: open

Hi,

I'm trying to upload a file to an API. The file can be sent in a streaming, but the way em-http-request does is not what I need I guess.

If I do `EM::HttpRequest.new('http://api.localhost', :connect_timeout => 15*60).post :file => "/path/to/bigfile.jpg"`, it sends the file as the body of my request but what I need to do is `EM::HttpRequest.new('http://api.localhost', :connect_timeout => 15*60).post :body => { :file => "/path/to/bigfile.jpg", :title => "Testing" }`

Beyond the file as a parameter, I would like to send the title of the file and the description of the file, but when I use the :file option, it ignores the :body. Also, I need to send the file as a parameter so the API can handle it.

Is it possible to upload files using the streaming in that way?