From: "Abir B." Date: 2007-10-23T21:43:26+09:00 Subject: Re: How to send a file from the http client to the server? Hi I created a form wich allows to select a file and send it to the server : ----------------- class FormHandler < Mongrel::HttpHandler def process(req, resp) resp.start do |head, body| body << "" body << "" body << "
" body << "" body << "
" body << "
" body << " " body << "" body << "" end end end class MyHandler < Mongrel::HttpHandler attr_accessor :responses_file def initialize end def process(req, resp) resp.start do |head, body| puts "Req.inspect",req.inspect puts "Req params",req.params i=0 req.body.each_line do |l| puts l end puts print i," lignes" body.write(""); body.write(" "); body.write(" Test Page"); body.write(" "); body.write(" "); ... body << "" end end end h = Mongrel::HttpServer.new("0.0.0.0", "3000") h.register("/test", MyHandler.new) h.register("/acc",FormHandler.new) h.run.join end --------------- Then when I run in the test page http://localhost:3000/test, I can see the content of the file in the request's body (puts l). But I don't know how to extract this data. I've to work on the string? Another question, how can I send the file directly (without passing by the form). Thanks -- Posted via http://www.ruby-forum.com/.