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 8141763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:37:13+00:00 2026-06-06T12:37:13+00:00

I am uploading image using filedrop.js. Code in application.js file looks like this:- $(.droparea).each(function(event){

  • 0

I am uploading image using filedrop.js. Code in application.js file looks like this:-

 $(".droparea").each(function(event){
  var game_id = $(this).attr('id')
  $(this).filedrop({
  maxfilezsize: 5,
  maxfiles: 1,
  dataType: "script",
  paraname :"custom_game[file]"
  url: "/game_plans/'+$(".dropbox").attr("rel")+'/games/'+game_id+/upload_file.js"
  })
 }

This part is working fine. I am getting into the proper action with proper parameters.

def upload_file
  # NOTE Upload_file action has been explicity written for the file upload using drag and drop
  @custom_game = CustomGame.find_or_initialize_by_id(params[:id])
  @game_plan = GamePlan.find(params[:game_plan_id])
  @custom_game.update_attributes(params[:custom_game])
  respond_to do |format|
    format.js
  end
end

upload_file.js.erb:

$("#<%=  @custom_game%>_file").html(<%= @custom_game.file%>);

But in view of respective action i.e. upload_file.js.erb I am not able to execute any of the javascript commands , whereas ruby commands are working properly. And in log also it says that the partial has been successfully rendered.

My log shows:-

(101.8ms)  COMMIT
Rendered activities/upload_file.js.erb (0.6ms)
Completed 200 OK in 379ms (Views: 10.8ms | ActiveRecord: 106.9ms)

I have no clue where I am making the mistake. No jquery command is being executed in upload_file.js.erb , but ruby commands are working properly.

  • 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-06T12:37:15+00:00Added an answer on June 6, 2026 at 12:37 pm
    $("#<%=  @custom_game%>_file").html(<%= @custom_game.file%>);
    

    <%= @custom_game %> returns the CustomGame object, where I think you ment to use @custom_game.title or something.
    jQuery cant find $(“#<#CustomGame:834793746>_file”) so html is not replaced.

    You might want to try the javascript in a console to check if it executes manually (using chrome’s dev tools myself)

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

Sidebar

Related Questions

I'm able to upload an image using ASIHTTPRequest. Code is something like this. -
Is there any sample application or code example for uploading image to picasa using
I'm using this php code for an image upload. But I keep getting an
In this case i am uploading an image using HTML and JavaScript. I need
Greetings, I'm uploading an image to my server using the following code: http://cocoadev.com/index.pl?HTTPFileUploadSample However,
I am having problem uploading image to mongodb using rails and carrierwave. This is
This is my code to upload image using ajaxfileupload and Jquery in my codeigniter
I am currently working with multiple php image uploading but using this SITE I
I am uploading image to server using base64 its working fine if image is
How should I handle image uploading using PHP? How should I handle the chmod

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.