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

  • Home
  • SEARCH
  • 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 3796148
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:11:30+00:00 2026-05-19T13:11:30+00:00

I think this should be an easy syntax question, but I’m not sure if

  • 0

I think this should be an easy syntax question, but I’m not sure if my approach is correct. I’m using paperclip to accept a file upload from Flash. The action successfully creates the object and saves the upload, but when it tries to generate an XML response with the default XML generator I think it chokes trying to include the paperclip attachment in the XML file. Rails shows a 406 error and Flash throws the I/O error.

I found a good resource on embedding paperclip attachments in XML but this is total overkill. All flash needs is a success or failure message. Something like:

def jpg_stream
  @photo = Photo.new(:name => params[:name], :uploaded => Time.now)
  @photo.image = params[:image]
  respond_to do |format|
    if @photo.save
      format.xml  { "<success/>" }
    else 
      format.xml  { render :xml => @photo.errors, :status => :unprocessable_entity }
    end
  end
end

What should this line be?

format.xml  { "<success/>" }

EDIT

This is the error stack trace. I think Rails has no problems returning whatever is generated, the 406 error means the browser/Flash will not accept the response.

Started POST "/generate_jpg" for 127.0.0.1 at 2011-01-25 12:59:24 -0700
  Processing by PhotosController#jpg_stream as HTML
  Parameters: {"name"=>"Test snapshot", "stream_id"=>"1", "Filename"=>"this.jpg",     "image"=>#<ActionDispatch::
Http::UploadedFile:...
[paperclip] identify -format %wx%h "C:/Users/Sam/AppData/Local/Temp/stream20110125-4048-zqbu60.jpg[0]" 2>NUL
  ←[1m←[35mAREL (1.0ms)←[0m  INSERT INTO "photos" ("name", "description", "stream_id", "created_at", "updated_at", "image_file_name", "image_content_type", "image_file_size", "image_updated_at") VALUES ('Test snapshot', '2011-01-25 19:59:24.630999', 1, '2011-01-25 19:59:24.687002', '2011-01-25 19:59:24.687002', 'this.jpg', 'application/octet-stream', 12251, '2011-01-25 19:59:24.651000')
[paperclip] Saving attachments.
[paperclip] saving .../system/images/86/original/this.jpg
Completed 406 Not Acceptable in 108ms
  • 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-05-19T13:11:30+00:00Added an answer on May 19, 2026 at 1:11 pm

    I would try a simpler version first: render :xml => "<success/>". I.e., drop respond_to completely, leave only

    if @photo.save
      render :xml => "<success/>"
    else 
      render :xml => @photo.errors, :status => :unprocessable_entity
    end
    

    I’m not sure about all nuances of respond_to (don’t use it myself), but doing format.xml { "<success/>" } might require a erb template from you.

    Including error stacktrace would be nice too.

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

Sidebar

Related Questions

I think this should be easy, but it's evading me. I've got a many-to-many
I think this will be easy but I can't see how to do it!
I think this must be a stupid question, but why do the results of
I think this question is rather easy for you shell scripting monsters. I am
think this should be an easy one... I want to get the currently selected
I think this should be an easy problem to solve, however its turned into
I think this is quite an easy question to answer, I just haven't been
This should be a really really simple thing, but for some reason it is
I think this is specific to IE 6.0 but... In JavaScript I add a
I think this is a multi-part question, so bear with me. Currently all of

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.