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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:13:10+00:00 2026-06-13T12:13:10+00:00

I am using simple HTML page for upload and post image to servlet then

  • 0

I am using simple HTML page for upload and post image to servlet then I convert image in byte[] and save in session using doPost() method:

        response.setContentType("text/html");
        items = upload.parseRequest(request);
    byte[] byteArray = item.get();
    request.getSession().setAttribute("image1", byteArray);

    out.println("<html>");
    out.println("<body onload='javascript:callParent()'>File uploaded successfully.");
    out.println("<img src='/ImageUpload' alt='' id='img2' name='img2' />");
    out.println("</body>");
    out.println("</html>");

in img tag’s src i am calling same servlet and in doGet() get byte[] stored in session and
send them back as following:

    response.setContentType("image/jpeg");
    byte[] byteArray =(byte[])request.getSession().getAttribute("image1");
    OutputStream output = response.getOutputStream(); 
    output.write(byteArray);
    output.close();

This code working fine in Mozilla but not working in IE only red X is being displayed but img tag is getting wide according to image size but not displayed any thing.
also when I click submit button twice then form get submitted in IE in other it is being submit in one click.

I am using IE-8 and image is of type .JPEG.
is there is any setting issue I tried to search on web but no any result.

  • 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-13T12:13:11+00:00Added an answer on June 13, 2026 at 12:13 pm

    Actually i was using onload() event of body tag to open browse button automatically.

        <body onload='frm1.imgUpload.click()'>
     <form action="ImgUpload" method="POST" enctype="multipart/form-data" name="frm1"  id="frm1">
        <input type='file' id = 'imgUpload' name = 'imgUpload'  onchange='frm1.submit()' />
    </form>
       </body>
    

    but when i remove code for opening browse through java script it started working fine with IE i don’t know what is the problem with IE and java script now i am clicking browse button manually and everything is working.

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

Sidebar

Related Questions

I'm using DOM PDF to convert a simple html page to a PDF--everything works
I'm using PeerTracker http://en.wikipedia.org/wiki/PeerTracker to track torrent hashes. I have a simple HTML page
I've been trying to make a simple search inside a static HTML page using
I am using jQuery for a simple website and have a main page 'index.html'
I'm attempting to upload a simple one page web page using Heroku. I was
I'm using 'Simple HTML Dom' to scrape the HN Front Page (news.ycombinator.com), which works
I have a simple HTML page (ratings.html) that I'm trying to test using HtmlUnit.
I'm using UIWebView for show a simple HTML page. When I scroll the page
I have a simple html page with a div. I am using jQuery to
I'm using Simple HTML DOM Parser and it works pretty fine. In the page

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.