Hi,

I'm looking into using merb to scale the file uploads on my Rails
website. I cannot afford to convert the whole application to merb
right now, so the Rails project and the merb app will coexist for a
while. For now, I'm looking into writing the simplest file upload
utility in merb. Here's what I have so far (code adapted from one of
Ezra's postings):

use_test :rspec
use_template_engine :haml
Merb::Config.use { |c|
  c[:framework]           = { :public => [Merb.root / "public", nil] }
  ...
}

Merb::Router.prepare do
  default_routes
end

uploader = Proc.new do |env|
  request = Merb::Request.new(env)
  if request.path =~ /uploads/
    params = request.params
    FileUtils.mv params[:file][:tempfile].path, Merb.root /
'uploads' / params[:file][:filename]
    [200, {}, 'ok']
  else
    [404, {}, 'not found']
  end
end

merb = Merb::Rack::Application.new

If I try to upload a file to the merb app (curl -F
"[email protected]" http://localhost:4000/upload), it will complain
about "Controller class not found for controller `upload'". I
obviously don't know how to use the router section. What do I need to
do to make it work? Or better yet, how can I identify that the params
contain a multipart form and/or an attached file?

I have a second question: is the very_flat app type the lightest merb
app that one can create? I need to make sure it has a really small
memory footprint, as it will need to serve many, concurrent, large
file uploads.

Thanks a lot,
Tiberiu

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to