url = URI.parse('http://myserver/services/upload.xml')
req = Net::HTTP::Post.new(url.path)
req.basic_auth 'username', 'password'
req['content-type'] = 'multipart/form-data;boundary=bbb'
......
req.body = %Q{--bbb
Content-Disposition: form-data; name="upload_file[]"; filename="my_file"
Content-Type: application/octet-stream
this is the content of the upload file.
this is the content of the upload file.
this is the content of the upload file.
--bbb
Content-Disposition: form-data; name="upload_file[]"; filename=""
Content-Type: application/octet-stream
--bbb--}
res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
p res
req.body = %Q{--bbb\015
Content-Disposition: form-data; name="upload_file[]"; filename="my_file"
Content-Type: application/octet-stream\015\012\015
this is the content of the upload file.
this is the content of the upload file.
this is the content of the upload file.
--bbb\015
Content-Disposition: form-data; name="upload_file[]"; filename=""
Content-Type: application/octet-stream\015\012\015
--bbb--}