# File uploads from Flex application

**URL:** <https://www.ruby-forum.com/t/file-uploads-from-flex-application/164578>\
**Category:** Rails\
**Created:** [April 2, 2009, 6:54pm UTC](https://www.ruby-forum.com/t/file-uploads-from-flex-application/164578 "2009-04-02T18:54:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crayfellow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e19b73/32.png) [@crayfellow](https://www.ruby-forum.com/u/crayfellow)\
**Post date:** [April 2, 2009, 6:54pm UTC](https://www.ruby-forum.com/t/file-uploads-from-flex-application/164578/1 "2009-04-02T18:54:15Z")

</div>

Hi all,

I’m looking for a recommendation for an application which needs to  
upload files. The deal is, these are files the application needs to  
upload to the RoR server app without prompting the user, so we don’t  
do any sort of browse.

The files could be anything: image, audio, video, swf, or even raw  
bitmap data from a clipboard paste. They become “assets” in our  
application, with a unique ID attached, a user-defined label, and  
another model which relates the asset ID’s to the object ID’s which  
contain the assets on the screen (think of this as a drawing  
application using some external assets).

So, my current attempt uses two models: one for the assets which has a  
file attachment, the label, etc. and one for the asset-to-object  
relation which is a one-to many relationship between asset ID’s and  
object ID’s. That’s all I’m trying to work with at the moment but once  
I sort that out I’ll be going further.

I’m trying to use Attachment Fu on the RoR side and File.upload on the  
AS side, and I have a little application which works for doing the  
kind of upload/update via a web browser RoR form, but not when using  
the Actionscript. I’m using the CD cover example from the Advanced  
Rails Recipes book.

I can find plenty of examples which simply upload files to rails, but  
there has to be a better way in which I can use something akin to an  
http service connection in Actionscript to get the files uploaded  
along with their asset data (and later, the id’s of the objects which  
use them for the other model).

Is this an esoteric case? I hope not. If you have any recommendations,  
please offer them up. Thank you !

-Patrick
