Multiple File Upload using SWFUpload on Rails. Part II

This part of the tutorial covers getting the files that you select via your swfupload setup to upload into your Rails application. Part I covers the setup: getting the external libraries, markup, and JavaScript all in place. You can find that here. This tutorial assumes you are using attachment_fu. The Flash / Rails principles would be the same if you are using Paperclip, but the syntax for the upload itself would vary. However, since the main sticking point is the fact that Flash doesn't send the session_id to Rails when it posts data, thereby denying Rails access to current_user or a valid session, it is my hope that this article will be helpful regardless of which attachment plugin you are using.

Read the rest of this post »

Getting Started with Multiple File Upload using SWFUpload on Rails. Part I

There seemed to be enough confusion about this that I decided to document it in the hopes of helping someone else out moving forward. This post will be in a couple of parts. The first part addresses the now seemingly obvious step-by-step of getting the markup and JS laid in correctly so you can trigger the file upload dialog box using swfupload. The next episode will show getting the uploads into your application.

The Goal

Integrate the swfupload multiple file upload into a Rails application. Getting Started First of all, the current location for the swfobject code is at googlecode. For this post I used the most recent version, 2.2 Beta 5. 

Media_httpimgskitchco_lncyt

Read the rest of this post »

Setting up Flash in Rails

Just a quick gotcha that got me tonight:
public/crossdomain.xml
public/movies/movie1.swf
Before I put my movies in their own subdirectory, i.e., when they were at the same level as crossdomain.xml, I was receiving a *** Security Sandbox Violation *** in the Flash Debug Console. After I put them in the movies/ directory, the violation went away. In short: # create a crossdomain.xml file And make it more secure than that -- that's only for development. # Put your movies below it # Load them into your app (I love haml):
%object{:width => "700", :height => "100"}
  %param{:name => "movie", :value => "movies/loggedInTest2.swf"}
    %embed{:src => "movies/loggedInTest2.swf", :width => "700", :height => "100"}