Flash Upload question


#1

Hi Rubiests,
This is my first posting to the rails group so please forgive me if this
is
a well-covered question (though I did check the wiki and the faqs on the
site).

I am trying to create a Flash-based bulk uploader for my first Ruby
project.
You can see an example of the uploader running in a PHP script here:

http://www.flavoredthunder.com/dev/flash/flashUploader/

This works swimmingly in php but there is no joy in Ruby.

I am using version “0.14.3” of Rails and “1.8.2” of Ruby on a Mac OS X
"10.3
"

The webbrick spits out a very unceremonious error when I try to call my
“admin/flash_create” action:

[14/Nov/2005:23:10:01 PST] “POST /admin/flash_create HTTP/1.1” 500 8175

  • -> /admin/flash_create

When doing some research on the problem I found a bug report on the
rails
site:

http://dev.rubyonrails.org/ticket/2277

They suggested installing the flash-fix plugin. I have installed the
flash-fix plugin into my vender/plugin directory but was unsure what to
do
past that.

My very basic method in the admin_controller is:

def flash_create
@params[‘Filedata’][‘content_name’] =
File.basename(@params[‘Filedata’][‘tmp_name’].original_filename).gsub(/[^a-zA-Z0-9.]/,
‘_’)
@params[‘Filedata’][‘content_type’] =
@params[‘Filedata’][‘tmp_name’].content_type.chomp
@params[‘Filedata’][‘data’] = @params[‘Filedata’][‘tmp_name’].read
@params[‘Filedata’].delete(‘tmp_name’)
@photo = Photo.new(@params[‘Filedata’])
@photo.save
end

“Filedata” is the field that Macromedia specifies for their multipart
file
transfers

Any help is greatly appreciated!

thanks,
Mark