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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:02:04+00:00 2026-05-27T17:02:04+00:00

I need to create a webpage where the user submits an XML file, which

  • 0

I need to create a webpage where the user submits an XML file, which I use to dynamically update the page.

I am following a tutorial and have this piece of code in a javascript file:

function uploadFile(){
    var path = "processXML?action=process&id=" + escape(fileChooser.value);
    req = initRequest();
    req.open("GET", path, true);
    req.onreadystatechange = callback;
    req.send(null);
}

I also have the URLpattern /processXMl set in a Java Servlet. Although I am learning something new, it’s not what I am trying to achieve. The open() method is specifying a file on the server.

How do I read/receive an XML file from the client so I can process it within my Java classes on the server?

  • 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-27T17:02:05+00:00Added an answer on May 27, 2026 at 5:02 pm

    Sending alone the file name (or the file path in some poor browsers) of the selected file as a request parameter isn’t going to work at all. You will not be able to retrieve the file contents in the server side in any way (unless both the webbrowser and webbrowser happen to run in physically the same machine, but this does of course not occur in real production). You need to let the client send the file contents instead. The file name is just metadata information.

    Sending the file contents by ajax was not possible until HTML5/XHR2, which is relatively new and not is supported in all browsers which are currently still widely in use. I’d suggest to simulate the asynchronous file upload by a form in a hidden iframe instead. There are lot of JavaScript plugins out for this, such as jQuery Form and jQuery Uploadify.

    To obtain the file contents in a servlet, you’d usually use Apache Commons FileUpload for this, or if you’re already on Servlet 3.0, the new HttpServletRequest#getParts() method.

    See also:

    • How to get the file path from HTML input form in Firefox 3
    • HTML5 File Upload to Java Servlet
    • How to upload files to server using JSP/Servlet?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a webpage which will have following features: It will have
I need to create an ASP page (classic, not ASP.NET) which runs remote shell
I am trying to develop a webpage which will need to create files in
I have an .xml file which has an accompanying .xsl file. The output of
I have a webpage that dynamically loads a user control. Each user control can
I need to create a request for a web page delivered to our web
Need to create a custom DNS name server using C which will check against
I need to create an XML schema that looks something like this: <xs:element name=wrapperElement>
I have to make a string by using the values which the user selects
I have a website where I need a javascript version of the current user

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.