[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    sending a file via http
From:       "Andrew" <nospam123 () anon ! com>
Date:       2003-04-08 5:32:35
[Download RAW message or body]

Hello,

I'm trying to send a file using http in a ruby script of mine.  I've been
trying to find an answer for this, but haven't been satisfied with anything
I've seen so far.

What I'm doing is this...
I've got a file on my host machine (no direct link to it from the web
page--and I don't want one) and the user is clicking on a link invoking my
ruby script which in turn attempts to send the file to the client.

This is what I have so far...
....
file = File.open("data.zip")
puts "Content-type: application/x-zip-compressed\n"
puts "Content-length: "+File.size("album.zip").to_s+"\n\n"

ok, now what?  How do I send the file data?  I can send plain text no
problem, but I don't know how to efficiently send this file.  Any help would
be appreciated.

Thanks,
Andrew



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic