http://www.collcoll.com/index.php/2005/11/15/more-on-flash-and-ruby-posting/
Later,
Mark
On 11/15/05, M Daggett <[EMAIL PROTECTED]> wrote:
Hi Guys (and Gals),
This is a bit off topic but since there are so many Ruby related projects going on in the OS Flash world I thought I'd give it a shot anyway.
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
On an unrelated note, can you append other data to the filedata object? I would like to append a session_id to ensure that people are not forging the post command and uploading without the use of my tool.
Any help is greatly appreciated!
thanks,
Mark
--
--------------------------------------------------------------------
I am Mark Daggett and I approve this message.
--
--------------------------------------------------------------------
I am Mark Daggett and I approve this message.
_______________________________________________ osflash mailing list [email protected] http://osflash.org/mailman/listinfo/osflash_osflash.org
