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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:39:37+00:00 2026-06-15T13:39:37+00:00

I am unable to upload the image as I am getting error in upload

  • 0

I am unable to upload the image as I am getting error in upload method of
user controller at line number 3 i.e. for @user.update_attributes(params[:user]).

My upload method code –

  def upload  
     @user = User.find_by_id(current_user.id)
   if @user.update_attributes(params[:user])  
    flash[:notice] = "Successfully uploaded Image."  
    if params[:user][:avatar].blank?  

      redirect_to @user  
    else  

      render :action => 'crop'  
    end  
  else  
    render :action => 'new'  
  end  
end  

My form –

   <%= form_for(:user, :url => {:action => 'upload'}, 
  :html => {:multipart => true}) do |f| %>

   <div class="inputs">

   <p>
     <%= f.label :avatar %>
     <%= f.file_field :avatar %>
   </p>
 </div>
   <div class="actions">
    <%= f.submit "Upload" %>
   </div>
 <% end %> 

My user model –

    class User < ActiveRecord::Base
      devise :database_authenticatable, :registerable,:recoverable, 
      :rememberable,  :trackable, :validatable

      attr_accessible :email, :password, :password_confirmation, :remember_me, :avatar

      has_attached_file :avatar, 
      :styles  => { :small => "100x100#", :large  => "500x500>" }  

    end

My output at command prompt –

    identify: unable to open image `file':  @ error/blob.c/OpenBlob/2498.
    identify: no decode delegate for this image format `file' @ error/constitute.c     /ReadImage/532.

 Started POST "/users/upload" for 127.0.0.1 at 2012-12-06 13:28:17 +0530
 Processing by UsersController#upload as HTML
 Parameters: {"utf8"=>"✓",  "authenticity_token"=>"mUPao835NCC8qXO553RJH50NWLhzQk03Z2G3Y0LwMYE=", 
"user"=>{"avatar"=>#<ActionDispatch::Http::UploadedFile:0xa20a418 @original_filename="freedomking.jpg",  @content_type="image/jpeg", @headers="Content-
 Disposition: form-data; name=\"user[avatar]\";  filename=\"freedomking.jpg            
 \"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20121206-3368-127uzt5>>}, "commit"=>"Upload"}
User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
CACHE (0.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
(1.1ms)  begin transaction
[paperclip] An error was received while processing:     
#<Paperclip::NotIdentifiedByImageMagickError: /tmp/stream20121206-7054-b
teogf.jpg is not recognized by the 'identify' command.>
[paperclip] An error was received while processing:    
#<Paperclip::NotIdentifiedByImageMagickError: /tmp/stream20121206-7054-b
teogf.jpg is not recognized by the 'identify' command.>
  (0.1ms)  rollback transaction
  • 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-15T13:39:38+00:00Added an answer on June 15, 2026 at 1:39 pm

    Finally I found the solution of my problem.

    Steps:

    1) Change gem "paperclip" to gem "paperclip", "~> 3.3.1" in a gemfile. This will install the latest paperclip gem for your bundle. The previous one didn’t.

    2) Change in User Model’s has_attached_file–

    has_attached_file :avatar,
    :path => ":rails_root/public/system/:attachment /:id/:style /:filename",
    :url =>  "/system/:attachment/:id/:style/:filename", 
    :styles  => { :small => "100x100#", :large => "500x500>" }  
    

    This may help somebody who is experiencing such problem.

    Cheers!

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

Sidebar

Related Questions

I am getting a Unable to load the requested file: default.php error in codeigniter
I keep getting this error when trying to configure the upload directory with Apache
I am trying to upload and share image using twitter4j library but unable to
I need some advice and guide line. I am trying to upload image into
im using the below code to upload multiple images, take the image file name,
Error: Unable to read data from the transport connection: A blocking operation was interrupted
I'm getting an Unable to obtain public key for StrongNameKeyPair. exception using Newtonsoft's JsonConvert.SerializeObject
For some reason, I'm unable to upload a file with the <asp:FileUpload /> control.
I am unable to upload file if there are multiple fields in my model
I'm trying to upload a image along with other fields. Been following examples from

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.