Forum: Ruby upload file via browser

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ae8a3b78d9782603e1db84a20ac3c351?d=identicon&s=25 Chris Henderson (Guest)
on 2009-06-04 16:55
(Received via mailing list)
I want to write a program to let people upload files to my computer
via a browser (www.mydomain.tld/upload) - what do I need in order to
write this code? Do I need to use RoR (I think RoR would be an
overkill in this situation)?

Thanks.
54185df1d348bbd34587fcd4f8e4779b?d=identicon&s=25 Louis-Philippe (Guest)
on 2009-06-04 17:14
(Received via mailing list)
only for file uploading,  the most efficient way would be with rack.Look
around for file uploading middleware.

If you want just a bit more sugar, try sinatra.

2009/6/4 Chris Henderson <henders254@gmail.com>
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (candlerb)
on 2009-06-04 17:31
For just an occasional file upload, even a CGI would be fine -
especially if you have a web server already running with a cgi-bin
directory.

Otherwise, if you want a standalone ruby process accepting uploads, I
agree that sinatra would be the easiest way to get going.

get '/upload' do
  ... display a HTML page with a form (enctype="multipart/form-post")
end

post '/upload' do
  ... parse the params, read the file, store it to disk
end
This topic is locked and can not be replied to.