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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:31:24+00:00 2026-06-02T09:31:24+00:00

hi i get this error when i submit the form java.io.IOException: Corrupt form data:

  • 0

hi i get this error when i submit the form “java.io.IOException: Corrupt form data: premature ending “,it happens when i add this code inside the existing scriptlet

String selectedValue=request.getParameter("sel1");
//out.println("Selected Value is: "+selectedValue);

String select1=request.getParameter("sel2");
//out.println("selected values is:"+select1);

String concat=selectedValue+"." +select1;
out.println(""+concat);

my existing scriptlet

<%@ page import="java.io.*,java.sql.*,java.util.zip.*,com.oreilly.servlet.*" %>
<%
try
 {    
   //if i include here,i can retrive the values but i cant upload the file into database,shows me "java.io.IOException: Corrupt form data: premature ending "
 String selectedValue=request.getParameter("sel1");
//out.println("Selected Value is: "+selectedValue);

String select1=request.getParameter("sel2");
//out.println("selected values is:"+select1);

String concat=selectedValue+"." +select1;
out.println(""+concat);

Connection connection = null;
String connectionURL = "jdbc:mysql://localhost:3306/ksa";
PreparedStatement psmnt = null;
    MultipartRequest request2=new MultipartRequest(request,"/home/adapco/Desktop/output",1024*1024*1024);
String filename=request2.getFilesystemName("file");

File f=request2.getFile("file");
out.println(f.exists()+"----------------"+f.getAbsolutePath());
out.print(filename);
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "root", "root");
psmnt = connection.prepareStatement("insert into file1(file_path) values(?)");
psmnt.setString(1, f.getPath());
int s = psmnt.executeUpdate();

 //if i include here it shows me null.null

String selectedValue=request.getParameter("sel1");
//out.println("Selected Value is: "+selectedValue);

String select1=request.getParameter("sel2");
//out.println("selected values is:"+select1);

String concat=selectedValue+"." +select1;
out.println(""+concat);

if(s>0)
{
 System.out.println("Uploaded successfully !");
}
else
{
 System.out.println("Error!");
}
}
catch(Exception e)
{
  out.print("-----------error--------------"+e);
}
%>

if i exclude the code from the existing one,it works fine.some times if i include the code after the catch or at the end of the try block,it shows me null.i need to read the index value of dropdowns and concatenate them with a dot. the error was “null.null”.the actual out come should be example: 1.1.
here is my html code

<%@ page language="java" %>
<HTML>
   <FORM ENCTYPE="multipart/form-data" ACTION="uploadFile.jsp" METHOD=POST>
    <center>
   <table bgcolor=#38ACEC>
    <tr>
    <center><td colspan="2" align="center"><B>UPLOAD THE FILE</B><center></td>
     </tr>
    <tr><td colspan="2" align="center"> </td></tr>
    <tr><td><b>Choose the file To Upload:</b></td>
    <td><INPUT NAME="file" TYPE="file"></td>
    </tr>
    <tr><td><select name="sel1">
     <option value="1">Aerospace</option>
     <option value="2">Automotive</option>
     <option value="3">Energy</option>
     <option value="4">IC Engines</option>
     <option value="5">Wind</option>
       <option value="6">Turbo</option>
      <option value="7">IT</option>
      <option value="8">Training</option>
     </select>
     <br>
     <select name="sel2">
     <option value="1">Internal</option>
     <option value="2">Demos</option>
     <option value="3">Best Practice</option>
       <option value="4">Marketing</option>
     <option value="5">Papers & public</option>
     <option value="6">Validation</option>
     <option value="7">Training</option>
      </select></td></tr>
      <tr><td colspan="2" align="center"> </td></tr>
      <tr><td colspan="2" align="center"><input type="submit" value="Send File"> </td></tr>
     <table>
   </center>
    </FORM>
   </html>  
  • 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-02T09:31:25+00:00Added an answer on June 2, 2026 at 9:31 am

    This is very old example you have got.Oreilly multipart parser MultipartRequest having some bugs . See related question for an overview Corrupt form data: premature ending (Resolved). Rather use Apache Commons FileUpload or just the new Servlet 3.0 built in request.getPart() method. See also How to upload files in JSP/Servlet?

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

Sidebar

Related Questions

I get this error whenever I submit the form also the action method is
I get this error, while I'm testing the code below: You have an error
Getting this error when I submit my form to savetext.aspx action file: Compiler Error
This is the error i get: 14:06:00,355 ERROR [JsonFilter] java.lang.NoSuchMethodException: byte.<init>(java.lang.String) I have a
I get this 'error' when running PEVerify on a custom generated assembly. [MD](0x8013124C): Error:
I get this error when trying ruby script/console Rails requires RubyGems >= . Please
I get this error message in Eclipse: Access restriction: The type DirectoryWalker is not
I get this error when I run a django app ( dpaste ) Template
I get this error when I try to use time_ago_in_words : Comparison of String
I get this error when trying to link a win32 exe project. I have

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.