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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:19:25+00:00 2026-06-13T19:19:25+00:00

I been working on a screencast pro proposed by Ryan called the Jquery file

  • 0

I been working on a screencast pro proposed by Ryan called the Jquery file uploads. However every time i input images it doesn’t get uploaded. I am not sure what i am doing wrong here my code. I am using google and did try to upload it but it doesn’t seem to be doing anything

Javascript
application.js

//= require jquery
//= require jquery_ujs
//= require jquery-fileupload/basic
//= require jquery-fileupload/vendor/tmpl
//= require_tree .

painting.js.coffee

jQuery ->
  $('#new_painting').fileupload

Views
_form.html.erb

<%= form_for @painting, :html => {:multipart => true} do |f| %>
  <div class="field">
    <%= f.hidden_field :galley_id %>
  </div>
  <div class="field">
    <%= f.label :image %><br />
    <%= f.file_field :image %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

index.html.erb

Painting Gallery

<%= form_for Painting.new do |f| %>
  <%= f.label :image, "Upload paintings:" %>
  <%= f.file_field :image, multiple: true, name: "painting[image]" %>
<% end %>

show.html.erb

<p><%= image_tag @painting.image_url %></p>

<p>
  <%= link_to "Edit", edit_painting_path(@painting) %> |
  <%= link_to "Destroy", @painting, :confirm => 'Are you sure?', :method => :delete %> |
  <%= link_to "Back to Paintings", paintings_path %>
</p>

Controller

def index
    @paintings = Painting.all
  end

  def show
    @painting = Painting.find(params[:id])
  end

  def new
    @painting = Painting.new
  end

  def create
    @painting = Painting.create(params[:painting])
  end

  def edit
    @painting = Painting.find(params[:id])
  end

  def update
    @painting = Painting.find(params[:id])
    if @painting.update_attributes(params[:painting])
      redirect_to paintings_url, notice: "Painting was successfully updated."
    else
      render :edit
    end
  end

  def destroy
    @painting = Painting.find(params[:id])
    @painting.destroy
    redirect_to paintings_url, notice: "Painting was successfully destroyed."
  end

Model

  attr_accessible :image
  mount_uploader :image, ImageUploader

My main issues is when it comes to upload any picture it just doesn’t have a submit button and not sure how to make it work, did i miss something??

  • 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-13T19:19:26+00:00Added an answer on June 13, 2026 at 7:19 pm

    You are likely successfully uploading the file to your controller action, but you’re not doing anythin with it other than

    @painting = Painting.create(params[:painting])
    

    You need to do more, like maybe saving the uploaded file somewhere on the server?

    def  create
      filename = params[:painting][:image].original_filename
      filetype = params[:painting][:image].content_type
      filedata = params[:painting][:image].read
      File.open("#{Rails.root.to_s}/images/#{filename}","wb") { |f| f.write(filedata) } 
      @painting = Painting.create(params[:painting])
    end
    

    This will extract the uploaded image and write it to the server. Content_type is handy if you want to record the MIME type in the database as well.

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

Sidebar

Related Questions

I been working on parsing out bookmarks from an export file generated by google
Ive been working some time on own template engines but i alwais get stuck
Been working with the canvas element with a library called Raphael Current revision: http://jsfiddle.net/G5mTx/27/
Ive been working with Python and C++ together for some time, but never tried
Been working on this query for some time now... Keep getting the error Corrosponding
Ive been working on create a file upload form using PHPmailer to send as
Ive been working on some jquery within a a page. Now all of a
Been working on a personal add-in for VS 2008 and have been researching automation
been working with symfony for a while. most tutorials describe having multiple actions in
i been working in the login code .. it works fine except this message

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.