From: nico itkin Date: 2010-09-23T22:05:12+09:00 Subject: Youtube File upload issue Hello, I'm triying to upload video to google api via direct upload (http://code.google.com/intl/fr/apis/youtube/2.0/developers_guide_protocol.html#Direct_uploading). I'm using an rails active resource class and would lie to handle the video uploading in a custom method with Nett::HTTP Here is google requirement : POST /feeds/api/users/default/uploads HTTP/1.1 Host: uploads.gdata.youtube.com Authorization: AuthSub token="DXAA...sdb8" GData-Version: 2 X-GData-Key: key=adf15ee97731bca89da876c...a8dc Slug: video-test.mp4 Content-Type: multipart/related; boundary="f93dcbA3" Content-Length: 1941255 Connection: close --f93dcbA3 Content-Type: application/atom+xml; charset=UTF-8 Bad Wedding Toast I gave a bad toast at my friend's wedding. People toast, wedding --f93dcbA3 Content-Type: video/mp4 Content-Transfer-Encoding: binary --f93dcbA3-- Here is my request object before to be sent : (irb)> y request body: | --RubyMultipartClient901619ZZZZZ Content-Type: application/atom+xml; charset=UTF-8 test 7 Film --RubyMultipartClient901619ZZZZZ Content-Type: video/mp4 Content-Transfer-Encoding: binary --RubyMultipartClient901619ZZZZZ-- body_stream: header: slug: - 01.mp4 x-gdata-key: - key=AI39si57I1WXXFZSHlDFjrfUgBapS7DoJ0hPppuqgC2FY_vK-nUQ8Iw7lTUJTdqwSCstyIhSWBk-C9JI1DCQolrmVvTcj6xvLg content-type: - multipart/related; boundary="RubyMultipartClient901619ZZZZZ" authorization: - AuthSub token="1/qqpJVDJ4Gziq6pLv8tmMWgIv4zxvwk3sZP9PiVHlCt4" gdata-version: - "2" content-length: - "672" method: POST path: /feeds/api/users/default/uploads request_has_body: true response_has_body: true I triyed to read the file and include its content in the body post, also tryed to include it after encoding in base64 (Base64.encode64(file.read)) The request is build and sent as follow : uri = URI.parse("http://uploads.gdata.youtube.com/feeds/api/users/default/uploads") http = Net::HTTP.new(uri.host, uri.port) request = Net::HTTP::Post.new(uri.request_uri) request.initialize_http_header(headers) request.body = post_body response = http.request(request) But it keeps responding : # I don't know what's wrong i'm completely stuck, could you give me a hand ? -- Posted via http://www.ruby-forum.com/.