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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:47:01+00:00 2026-05-23T16:47:01+00:00

i am uploading image from a simple html form <form action=../OctetStreamReader method=post accept=image/gif, image/jpeg>

  • 0

i am uploading image from a simple html form

 <form action="../OctetStreamReader" method="post"  accept="image/gif, image/jpeg">
 Your image: <input type="file" name="pic" id="pic" /><br />
 <input type="submit" value="Submit" />
 </form>

and inside OctetStreamReader i am copying the image on server using IOUtils

realPath = getServletContext().getRealPath(DESTINATION_DIR_PATH) + "/";
    PrintWriter writer = null;
    InputStream is = null;
    FileOutputStream fos = null;

    try {
        writer = response.getWriter();
    } catch (IOException ex) {
        log(OctetStreamReader.class.getName() + "has thrown an exception: "
                + ex.getMessage());
    }

    if (canInsert) {
        // String filename = request.getHeader("X-File-Name");
        String filename = utils.createFileName(ssn, userEmail, userId);
        try {
            ImageCompressor ic= new ImageCompressor();

            is = request.getInputStream();
            fos = new FileOutputStream(new File(realPath + filename));
            logger.info("avalible bytes :" + is.available());
            IOUtils.copy(is, fos);
            logger.info("inserting copied");

the code is working absolutely fine in all browsers except IE and especially IE7.
In case of IE7 , a new file is created on the server but with file size 0kb.
and In case of other browsers like chrome,FF,safari , new file is created with the actual size of uploaded image.
i am unable to trace out the problem as the code is not throwing any exception.

Please Help ..

Thanks !

  • 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-23T16:47:02+00:00Added an answer on May 23, 2026 at 4:47 pm

    i tried using Apache Commons File Upload and it worked perfectly

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

Sidebar

Related Questions

I'm having some difficulties with uploading an image from an html form. The form
I am uploading in image via a form and I want to, in addition
I'm working on a project that involves uploading an image to tumblr from Python.
I am working on a task to enable image uploading and auto-scaling(from full sized
I want to make a fancy image uploading system in html. When the user
i doing app for uploading image to php server from android and the php
I'm uploading an image from Android to a PHP server. In android I'm encoding
Is there a way to load image from an input type=file on a page
I'm uploading image files from device to a PHP server by converting the file
Instead of uploading image one by one, how do i achieve to upload all

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.