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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:06:50+00:00 2026-06-18T16:06:50+00:00

I’m trying to upload a file through ajax but when I’m trying to access

  • 0

I’m trying to upload a file through ajax but when I’m trying to access that file I’m getting this error:

NS_ERROR_XPC_BAD_OP_ON_WN_PROTO: Illegal operation on WrappedNative prototype object

In jquery min on line :

 b = f.isFunction(b) ? b() : b, d[d.length] = encodeURIComponent(a) + "=" + encodeURIComponent(b)

Here is my jquery code:

$('#new_ar_bji_o_involved').submit( function(e){

    e.preventDefault();
    selectedid = $(this).attr('id');
    var report ={};
    report.authenticity_token = $(this).find('input[name=authenticity_token]').val();
    report.utf8 = $(this).find('input[name=utf8]').val()
    //$(this).serialize();
    report.other_involved = {};
    report.other_involved.ar_bail_juvinfo_id = $(this).find('#ar_bj_info_id').val();
    var d = document.getElementById('ar_bji_o_involved_mugshot');
    var B = d.files[0];
    report.other_involved.mugshot = B;

    $.ajax({
        type: "POST",
        url : "url?format=json",
        cache: false,
        data: report,
        contentType: "application/json",
        dataType: "json",
        success:function(data){
            //alert(data);
        },
        complete: function (data) {
             $("#dialog-message").dialog("open");
        }
    });     
}); 

My form

<form accept-charset="UTF-8" action="/crash_report/ar_save" class="changedateformat" enctype="multipart/form-data" id="new_ar_bji_o_involved" method="post">

<input id="ar_bji_o_involved_mugshot" name="ar_bji_o_involved[mugshot]" type="file">
</form>

I’m using ruby on rails carrier wave gem to upload the file. But I’m getting error before the controller is called in firebug.

I have this code which works fine:

var d = document.getElementById('imgid');
A = new FormData();
var B = d.files[0];

A.append("contentType", "application/json");
                A.append("key", "b7ea18a4ecbda8e92203fa4968d10660");
A.append("employeeEvent[external_doc]", B);
A.append("employeeEvent[description]", $('#descriptionid').val());
A.append("employeeEvent[user_id]", $('#user_id').val());

var xhr = new XMLHttpRequest();
 xhr.open("POST", "/employee_management/add_event?format=json", true);   // <-- provide the proper URL

xhr.send(A);

May be you guys can suggest something from here?

Thanks in advance.

  • 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-18T16:06:51+00:00Added an answer on June 18, 2026 at 4:06 pm

    you cannot post a multipart form through AJAX because Javascript does not have access to your filesystem.

    Use Remotipart. It makes ajax uploads much simpler way.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.