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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:55:52+00:00 2026-06-17T14:55:52+00:00

This has had me stumped all day. My app provides for the upload of

  • 0

This has had me stumped all day.

My app provides for the upload of documents, once uploaded it runs create.js.erb and adds the new record to the page.

My HTML looks like this,

<div id="doc_upload">
  <%= form_for Document.new, remote: true do |f| %>
  <%= f.file_field :file, multiple: true, name: "document[file]" %>
  <%= f.hidden_field :plot_id %>
  <%= f.submit 'upload' %>
  <% end %>
</div>

I have a create.js.erb file in the documents directory. I am presently using JQuery file upload and the drag and drop file upload causes no issues. However when I use this form to manually select a file and upload I get:

  • a 406 HTTP error
  • the page redirects to /documents
  • when i go back, the file has been successfully uploaded and saved.

The headers are as follows.

Request URL:http://localhost:3000/documents
Request Method:POST
Status Code:406 Not Acceptable
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8}

my controller is:

def create
  @document = Document.create(params[:document])
  respond_to do |format|
    format.js
  end
end

As I said this really has me scratching my head, as the Ajax request doesnt seem to be firing. Does this mean that it may be something to do with the unobtrusive JS no picking up the remote true data type. That is the only reason that I can think of the redirection.

If so how I confirm and fix this?

Any help would be great.

Ross

  • 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-17T14:55:53+00:00Added an answer on June 17, 2026 at 2:55 pm

    You have to add :multipart => true if you have file upload in your form.

    but you cannot post a multipart form via AJAX

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

Sidebar

Related Questions

This has had me stumped for a while. None of the commonly encountered similar
I'm sure this is easy but it has had me stumped for ages. I
Ok, this has had me stumped for a while - One of our clients
This question has been asked and answered numerous times, but I'm still stumped. All
This has had me stumped for a bit and I can't seem to figure
This has had me stumped for days. I am trying to get an mp4
Alright, this has had me stumped on and off for a couple of months
Okay people, I'm sure someone has had this issue and can help me out.
I'm aware that MD5 has had some collisions but this is more of a
Has anyone had this problem? I deleted a column in the table editor and

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.