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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:07:54+00:00 2026-06-01T07:07:54+00:00

On my current page I use old file upload with input element. However, now

  • 0

On my current page I use old file upload with input element. However, now I’ve implemented drag&drop from that very nice series of articles: http://www.sitepoint.com/html5-file-drag-and-drop/

There’s one snag. Before rewriting the page I was submitting the form with the file and server side service (Java’s appspot.com) did all the magic of retrieving the file, saving to DB etc. I would still like to take advantage of that service. However now, after rewriting the file upload to use XMLHttpRequest my code simply writes file to the content, whereas service expects form.

Is there a way to mimick miltipart/form-data form submission with XMLHttpRequest?

  • 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-01T07:07:55+00:00Added an answer on June 1, 2026 at 7:07 am

    The FormData object can be used to submit multipart/form-data forms.

    Basic example:

    var fd = new FormData(); // Optionally: new FormData(htmlFormElement);
    fd.append('key', 'value');
    fd.append('file', reference_to_File_object);
                      //  ^ Example: .files property of an <input type="file"
    
    var xhr = new XMLHttpRequest();
    xhr.open('post', '/postdata', true);
    xhr.send(fd);
    

    When strings are passed to the .send() method of an XMLHttpRequest instance, it is converted to unicode, then encoded as UTF-8. This means that a custom multipart/form-data implementation, using strings, will often not work correctly.

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

Sidebar

Related Questions

I' trying to use window.pageYOffset & window.scrollMaxY to calculate the current page progress. This
How does one style links for the current page differently from others? I would
I used this code to print the current page: <form> <input type=button value=Print onClick=window.print();
How can I go to the previous page from Current Page? For Instance: First
Basic question - is it possible to access the current Page from a static
In .NET is it possible to get the HttpContext of the current page from
I'm trying to create an auto generated post excerpt from the current page's post
On my current project we generate JAXB beans from an XSD file. We need
I am rewriting the controller render method, however, I want to use the old
I am building an multiple file upload form that user can use to upload

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.