[Mongrel] dealing with multipart forms in a Mongrel::HttpHandler

Ezra Zygmuntowicz
Thu, 21 Dec 2006 21:58:06 -0000

On Dec 21, 2006, at 12:56 PM, Mark wrote:

> Hi everyone,
>
> Is there an easy way to parse multipart form requests from within a
> Mongrel::HttpHandler subclass or do I need to break out RFC 2388
> and a bunch of regexps?
>
> Thanks,
>
> Mark


Hey Mark-

	There is nothing in mongrel to do that for you right now. You can
either use the cgi.rb library(yuck!) or you can parse it yourself.
You can look at how I do it in merb which is a take off on how
camping does it but with some enhancements. You also might want to
look at how the serverside gem does the mime parsing.


The initialize method here parses the incoming mime stuff including
file uploads or multi part forms:

http://svn.devjavu.com/merb/lib/merb/merb_controller.rb

Cheers-
-- Ezra Zygmuntowicz
-- Lead Rails Evangelist
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)