Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8162607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:46:14+00:00 2026-06-06T18:46:14+00:00

I’m using Rails 3.1 with Paperclip and trying to implement Uploadify for multiple file

  • 0

I’m using Rails 3.1 with Paperclip and trying to implement Uploadify for multiple file uploads on a single page. I tried following various samples, including: Rails3-Paperclip-Uploadify

Currently I have a Upload model which has a one to many relationship with my UploadImage model – This is what I had setup so far for my view:

UploadImages/new.html.erb

<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" %>
<%= javascript_include_tag "swfobject.js", "jquery.uploadify.v2.1.0.js" %>

<script type="text/javascript" charset="utf-8">
    <%- session_key = Rails.application.config.session_options[:key] -%> 
    $(document).ready(function() 
    {
        // Create an empty object to store our custom script data
        var uploadify_script_data = {};

        // Fetch the CSRF meta tag data
        var csrf_token = $('meta[name=csrf-token]').attr('content');
        var csrf_param = $('meta[name=csrf-param]').attr('content');

        // Now associate the data in the config, encoding the data safely
        uploadify_script_data[csrf_token] = encodeURI(encodeURI(csrf_param));

        $('.uploadify').uploadify
        ({
            uploader        :   '/uploadify/uploadify.swf',
            cancelImg       :   '/uploadify/cancel.png',
            multi           :   true,
            auto            :   false,
            onComplete      :   function(event, queueID, fileObj, response, data)
                                { 
                                    var dat = eval('(' + response + ')');
                                    $.getScript(dat.upload);
                                },
            scriptData      :   {
                                    '_http_accept': 'application/javascript',
                                    'format' : 'json',
                                    '_method': 'post',
                                    '<%= session_key %>' : encodeURIComponent('<%= u cookies[session_key] %>'),
                                    'authenticity_token': encodeURIComponent('<%= u form_authenticity_token %>'),
                                    'upload_id' : '<%= @upload.id %>'
                                }
        });         
    }); 


</script>

<%= form_for @upload.upload_images.build, :html => { :class => "upload", :multipart => true } do |f| %>  
                    <%= f.file_field :image, :class => "uploadify" %>
                    <%= submit_tag "Submit Upload", :disable_with => "Uploading", :class => "submit"%>
<% end %>

I see the uploadify flash button, I select a few files and submit but this is all I see in my params:

{“utf8″=>”✓”,
“authenticity_token”=>”K1bSH/FO0Hjdum0aiNU45mHJXezXTiCgh9XVmk1jrZM=”,
“commit”=>”Submit Upload”, “action”=>”create”,
“controller”=>”upload_images”}

As you can see there is no file data being sent and even the scriptData that I specify doesn’t get sent, I noticed that other people’s code uses the script parameter for the uploadify function. In PHP frameworks they point it to the .php file which handles the saving. I’m using Paperclip so I wasn’t sure how to implement this… perhaps this is my problem? Let me know if you need any additional details.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:46:16+00:00Added an answer on June 6, 2026 at 6:46 pm

    I found the answer by looking at this question: uploadify rails 3 nothing happens after the file is chosen

    I had to attach some events to my submit button and add the script parameter to the uploadify function as I surmised.

    So for starters in my config/routes.rb I needed to add:

    post "upload_images/create"
    

    And in my view I added:

    $('#submit').click(function(event){
                event.preventDefault();
            });
    
    
    $('#submit').click(function(event){
                event.preventDefault();
                $('.uploadify').uploadifyUpload();
    });
    

    and finally I added the script param to my initial uploadify function call:

    script          :   '/upload_images/create'
    

    After many hours of beating my head against it’s finally working and making sense! Hope this helps somebody else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Paperclip to handle profile photo uploads in my app. They upload
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am trying to render a haml file in a javascript response like so:
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am using parse_ini_file to read the contents of a file however it is
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.