Upload snapshot image from flash to server


Today i wanted to upload a captured image from a movieclip in a flash movie to a rails server. there are some task to complete to to this.

1. Flash Upload
I found a really nice und usefull class this morning. you can capture a bitmap image from a movieclip or from webcam and send it t othe server. it is possible to add other parameters. the class creates a request like the FileReference class would do. on server side it looks the same.

ow-to-take-a-snapshot-of-a-flash-movie-and-automatically-upload-the-jpg-to-a-server-in-three-easy-steps

2. save image in rails
i’m totally new to RubyOnRails but my first impression is really great. you can do everything in few lines of code. for upload und processing of images i found the paperclip gem and this two great tutorials:

http://jimneath.org/2008/05/15/swfupload-paperclip-and-ruby-on-rails.html

http://jetpackweb.com/blog/2009/10/21/rails-2-3-4-and-swfupload-rack-middleware-for-flash-uploads-that-degrade-gracefully/

3. deal with the session problem

rails uses a cookie based session and if you upload files with flash this cookie is not send. the solution for this problem is this gem:
flash_cookie_session.

for more information you can read here:
rails 3 or
rails 2.3

all together works like a charm.

Comments are closed.