Begin main content

Web file uploading the EASY way

Yes why, Ruby is indeed poignant. Uploading files with cgi/perl/mason/aolserver is a pain in the butt. With ruby, it's:

def upload_customers
file_content = @params["customers_prn_file"].read
end

It's almost too easy!

10:37 PM, 01 Feb 2006 by Mark Aufflick Permalink | Short Link

I like Ruby too, but ...

I kinda take exception to the assertion that "uploading files in AOLserver is a pain in the butt." Lets post the AOLserver method: set fd [open [ns_queryget customer_prn_file.tmpfile] r] fconfigure $fd -translation binary set file_content [read $fd] close $fd Sure, it's not a one-liner, but I wouldn't go so far as to call it "a pain in the butt." And, if you really found yourself doing a lot of this, it could be refactored out into a proc. :-)

by Unregistered Visitor on 02/25/06

That unregistered visitor ^^ up there, is me

-- Dossy Shiobara

by Unregistered Visitor on 02/25/06

Maybe it's a comfort thing as well

As with most things, AOLserver is easier and cleaner than the usual alternatives. And don't get me wrong - I'm a big fan of AOLserver for web application development. If I can shoehorn ruby into AOLserver that would be a real winning combo. Somthing about being passed a file handle just feels so clean. Why should I as the application developer be interested in the fact that the webserver creates a tempfile for http uploads? If AOLserver's file uploading system was refactored to use a ram buffer or a database blob then the api would have to change. Not so if a file handle was passed.

by Mark Aufflick on 02/27/06

Add comment