Ammar Ali wrote: > On Sat, Aug 28, 2010 at 4:56 PM, Kad Kerforn <yves_dufour / mac.com> > wrote: >> ... >> >> is my http.post wrong ?? > > http://stanislavvitvitskiy.blogspot.com/2008/12/multipart-post-in-ruby.html Thanks a lot Amar, could not get it right ... I switched to curb ( http://github.com/taf2/curb ) and it works ( 5 mn to install and understand it then running ...) def add_attachment(story_id, filepath) resource_uri = URI.parse("http://#{@base_url}/#{@project_id}/stories/#{story_id}/attachments") request = Curl::Easy.new("#{resource_uri}") do |curl| curl.headers["X-TrackerToken"] = @token curl.on_success do |response| doc = Hpricot(response.body_str).at('attachment') @return = { :id => doc.at('id').innerHTML.to_i, :status => doc.at('status').innerHTML } end curl.on_failure do |response, err| begin raise TrackerException.new(err.inspect) rescue TrackerException => e logger = Log4r::Logger['test'] logger.error("ADD ATTACHMENT : #{e.message}") logger.error("#{e.backtrace}") @return = nil end end end request.multipart_form_post = true request.http_post(Curl::PostField.file("Filedata", "#{filepath}")) @return end no worry about building a multi-part form.... ! -- Posted via http://www.ruby-forum.com/.