You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Irshad Mungly <ir...@celsoft.co.za> on 2001/01/08 08:14:07 UTC
MULTIPART/FORM-DATA Error.
Hi everyone,
I do nt know if it is at this list that I was supposed to send this message.
I am new to JSP and Tomcat. I need to write a JSP and Java Bean to upload
a file to the server. I wrote a HTML FORM to accept the file name. (below).
When I used "multipart/form-data" in the form I get a servlet error.
Can anyone help or point me to some other link for help.
Thanks.
--------------- HTML FILE f1.html:
<FORM ENCTYPE="multipart/form-data" method="post" action="f2.jsp">
Your Name <input type="TEXT" name="username" > <br>
Email <input type="TEXT" name="emailaddr" > <br>
File Name <input type="FILE" name="filename" > <br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</FORM>
--------------- JSP FILE f2.jsp:
<%@ page import="FileUpload.fup" %>
<jsp:useBean id="mybean" scope="page" class="FileUpload.fup" />
<jsp:setProperty name="mybean" property="*" />
<% mybean.processRequest(request); %>
<FORM ENCTYPE="multipart/form-data" method="post">
Your Name. <input type="text" name="username" size="50"> <br>
Email . <input type="text" name="emailaddr" size="50"> <br>
File Name. <input type="file" name="filename" size="50"> <br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</FORM>
--------------- fup.java:
package FileUpload;
import java.io.*;
import java.util.Hashtable;
import java.util.Enumeration;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Random;
public class fup extends HttpServlet
{
private String username;
private String filename;
private String emailaddr;
private String messageline;
// By default, 1Mb max file size per file;
protected int MaxSize = 1024*1024*1; // 1MB
public fup()
{
username = null;
filename = null;
emailaddr = null;
messageline =null;
}
public void setUsername( String name )
{
username = name;
}
public void setFilename( String name )
{
filename = name;
}
public void setEmailaddr( String name )
{
emailaddr = name;
}
public String getUsername()
{
return username;
}
public String getFilename()
{
return filename;
}
public String getEmailaddr()
{
return emailaddr;
}
public void setMessageline( String name )
{
messageline = name;
}
public String getMessageline()
{
return messageline;
}
public void processRequest(HttpServletRequest req)
throws ServletException, IOException
{
Hashtable table;
String l_msg;
if (emailaddr.equals("email"))
setMessageline("Submit Email Address");
else
setMessageline("Else Submit File");
// Check if the Form had Multipart/Form-data set
l_msg = req.getContentType();
if (!req.getContentType().toLowerCase().startsWith("multipart/form-data"))
{
l_msg = "Wrong content " + req.getContentType();
setMessageline(l_msg);
return;
}
setMessageline("OK");
return;
}
}
Re: MULTIPART/FORM-DATA Error.
Posted by Andrew Cockburn <ac...@aqualog.co.uk>.
Hi,
I'm still not sure I understand what you are trying to do -
If you have a working example of an HTML form, just rename it .jsp and you have a working jsp to upload the data. An upload needs something to talk to, so you need a servlet. As far as I understand it you already have this working so I don't know why you want to convert it to a JSP and BEAN in the way you are trying to. In any case - the above is what I have working, and I don't know of any other way of doing it.
Regards,
Andrew
----- Original Message -----
From: Irshad Mungly
To: general@jakarta.apache.org ; acockburn@aqualog.co.uk
Sent: Monday, January 08, 2001 2:36 PM
Subject: Re: MULTIPART/FORM-DATA Error.
Hi Andrew,
What I need to do is a Java bean to upload a file to the server.
The Java bean must be run in conjunction with a JSP page.
The java program that I included is the first part of the program
where the error is coming. I have got an HTML that uploads to a servlet running
in Tomcat without any error. I was trying to convert the servlet to a Java Bean and JSP.
I am not sure if I am on the right track. If you know of a different way to
do the upload, please let me know I need it urgently.
Thanks again,
Bye
Irshad.
Andrew Cockburn wrote:
HI,
I'm not quite sure what you are trying to do here - I have an HTML form that uploads to a servlet running in Tomcat, and that works fine.
I am not sure what you are trying to do with your JSP - it doesn't look like it could work (what is the forms action set to ?) but maybe this is just ignorance on my part.
Andrew
----- Original Message -----
From:Irshad Mungly
To:general@jakarta.apache.org ; acockburn@aqualog.co.uk
Sent: Monday, January 08, 2001 12:32 PM
Subject: Re: MULTIPART/FORM-DATA Error.
Hi Andrew,
I have got the final version on Tomcat 3.2.
I got the program as a servlet but with a JSP it does not work.
Any idea.
Thanks,
Irshad
Andrew Cockburn wrote:
Hi,
Firstly, make sure you are using Tomcat v3.2 with the latest updates - I think there were some problems in earlier versions.
Secondly, take a look at the O'Reilly utility classes - they provide code for doing this. I use it and it works fine with Tomcat 3.2.
You can find it at :
http://www.servlets.com/resources/com.oreilly.servlet/index.html
Good luck,
Andrew
----- Original Message -----
From:Irshad Mungly
To:general@jakarta.apache.org
Sent: Monday, January 08, 2001 7:14 AM
Subject: MULTIPART/FORM-DATA Error.
Hi everyone,I do nt know if it is at this list that I was supposed to send this message.I am new to JSP and Tomcat. I need to write a JSP and Java Bean to uploada file to the server. I wrote a HTML FORM to accept the file name. (below).When I used "multipart/form-data" in the form I get a servlet error.Can anyone help or point me to some other link for help.Thanks.--------------- HTML FILE f1.html:<FORM ENCTYPE="multipart/form-data" method="post" action="f2.jsp"> Your Name <input type="TEXT" name="username" &g!t; <br> Email <input type="TEXT" name="emailaddr" > <br> File Name <input type="FILE" name="filename" > <br> <input type="submit" value=!
"Submit"> <input type="reset" value="Reset">-->--></FORM>--------------- JSP FILE f2.jsp:<%@ page import="FileUpload.fup" %><jsp:useBean id="mybean" scope="page" class="FileUpload.fup" /><jsp:setProperty name="mybean" property="*" /><% mybean.processRequest(request); %><FORM ENCTYPE="multipart/form-data" method="post"> Your Name. <input type="text" name="username" size="50"> <br> Email . <input type="text" name="emailaddr" size="50"> <br> File Name. <input type="file" name="filename" size="50"> <br> <input type="submit" value="Submit"> <input type="reset" value="Reset"></FORM>--------------- fu!p.java:package FileUpload;import java.io.*;import java.util.Hashtable;import java.util.Enumeration;import javax.servlet.*;import javax.servlet.http.*!
;import java.util.Random;public class fup extends HttpServlet{ private String username; private String filename; private String emailaddr; private String messageline; // By default, 1Mb max file size per file; protected int MaxSize = 1024*1024*1; // 1MB public fup() { username = null; filename = null; emailaddr = null; messageline =null; } public void setUsername( String name ) { username = name; } public void setFilename( String name ) { filename = name; } public void setEmailaddr( String name ) { emailaddr = name; } public String getUsername() { return usern!ame; } public String getFilename() { return filename; } public String getEmailaddr() { return emailaddr; } public void setMessageline( String name ) { messageline = name; } public String getMessageline() { return messageline; } public void processRequest(HttpServletRequest req) throws ServletException, IOException { Hashtable table; String l_msg; if (emailaddr.equals("email")) setMessageline("Submit Email Address"); else setMessageline("Else Submit File"); // Check if the Form had Multipart/Form-data set l_msg = req.getContentType(); if (!req.getContentType().toLowerCase().startsWith("multipart/form-data")) { l_msg = "Wrong content " + req.getContentType(); setMessageline(l_msg); ! return; } setMessageline("OK"); return; }}
Re: MULTIPART/FORM-DATA Error.
Posted by Irshad Mungly <ir...@celsoft.co.za>.
Hi Andrew,
What I need to do is a Java bean to upload a file to the server.
The Java bean must be run in conjunction with a JSP page.
The java program that I included is the first part of the program
where the error is coming. I have got an HTML that uploads to a servlet
running
in Tomcat without any error. I was trying to convert the servlet to a
Java Bean and JSP.
I am not sure if I am on the right track. If you know of a different way to
do the upload, please let me know I need it urgently.
Thanks again,
Bye
Irshad.
Andrew Cockburn wrote:
> HI,
>
>
>
> I'm not quite sure what you are trying to do here - I have an HTML
> form that uploads to a servlet running in Tomcat, and that works fine.
>
>
>
> I am not sure what you are trying to do with your JSP - it doesn't
> look like it could work (what is the forms action set to ?) but maybe
> this is just ignorance on my part.
>
>
>
> Andrew
>
>
>
> ----- Original Message -----
>
> From:Irshad Mungly <ma...@celsoft.co.za>
>
> To:general@jakarta.apache.org <ma...@jakarta.apache.org>
> ; acockburn@aqualog.co.uk <ma...@aqualog.co.uk>
>
> Sent: Monday, January 08, 2001 12:32 PM
>
> Subject: Re: MULTIPART/FORM-DATA Error.
>
>
> Hi Andrew,
>
> I have got the final version on Tomcat 3.2.
> I got the program as a servlet but with a JSP it does not work.
> Any idea.
>
> Thanks,
>
> Irshad
>
> Andrew Cockburn wrote:
>
>> Hi,
>>
>>
>>
>> Firstly, make sure you are using Tomcat v3.2 with the latest
>> updates - I think there were some problems in earlier versions.
>>
>>
>>
>> Secondly, take a look at the O'Reilly utility classes - they
>> provide code for doing this. I use it and it works fine with
>> Tomcat 3.2.
>>
>>
>>
>> You can find it at :
>>
>>
>>
>> http://www.servlets.com/resources/com.oreilly.servlet/index.html
>>
>>
>>
>> Good luck,
>>
>>
>>
>> Andrew
>>
>> ----- Original Message -----
>>
>> From:Irshad Mungly <ma...@celsoft.co.za>
>>
>> To:general@jakarta.apache.org <ma...@jakarta.apache.org>
>>
>> Sent: Monday, January 08, 2001 7:14 AM
>>
>> Subject: MULTIPART/FORM-DATA Error.
>>
>>
>> Hi everyone,
>>
>> I do nt know if it is at this list that I was supposed to
>> send this message.
>> I am new to JSP and Tomcat. I need to write a JSP and Java
>> Bean to upload
>> a file to the server. I wrote a HTML FORM to accept the file
>> name. (below).
>>
>> When I used "multipart/form-data" in the form I get a servlet
>> error.
>>
>> Can anyone help or point me to some other link for help.
>>
>> Thanks.
>>
>>
>>
>> --------------- HTML FILE f1.html:
>> <FORM ENCTYPE="multipart/form-data" method="post"
>> action="f2.jsp">
>> Your Name <input type="TEXT" name="username" &g!
>> t; <br>
>> Email <input type="TEXT" name="emailaddr" > <br>
>> File Name <input type="FILE" name="filename" > <br>
>> <input type="submit" value="Submit">
>> <input type="reset" value="Reset">--></FORM>
>>
>>
>> --------------- JSP FILE f2.jsp:
>>
>> <%@ page import="FileUpload.fup" %>
>> <jsp:useBean id="mybean" scope="page" class="FileUpload.fup" />
>> <jsp:setProperty name="mybean" property="*" />
>> <% mybean.processRequest(request); %>
>> <FORM ENCTYPE="multipart/form-data" method="post">
>> Your Name. <input type="text" name="username" size="50"> <br>
>> Email . <input type="text" name="emailaddr" size="50"> <br>
>> File Name. <input type="file" name="filename" size="50"> <br>
>> <input type="submit" value="Submit">
>> <input type="reset" value="Reset">
>> </FORM>
>>
>> --------------- fu!
>> p.java:
>>
>> package FileUpload;
>>
>> import java.io.*;
>> import java.util.Hashtable;
>> import java.util.Enumeration;
>> import javax.servlet.*;
>> import javax.servlet.http.*;
>> import java.util.Random;
>>
>> public class fup extends HttpServlet
>> {
>>
>> private String username;
>> private String filename;
>> private String emailaddr;
>> private String messageline;
>>
>> // By default, 1Mb max file size per file;
>> protected int MaxSize = 1024*1024*1; // 1MB
>>
>> public fup()
>> {
>> username = null;
>> filename = null;
>> emailaddr = null;
>> messageline =null;
>> }
>>
>> public void setUsername( String name )
>> {
>> username = name;
>> }
>>
>> public void setFilename( String name )
>> {
>> filename = name;
>> }
>>
>> public void setEmailaddr( String name )
>> {
>> emailaddr = name;
>> }
>>
>> public String getUsername()
>> {
>> return usern!
>> ame;
>> }
>>
>> public String getFilename()
>> {
>> return filename;
>> }
>>
>> public String getEmailaddr()
>> {
>> return emailaddr;
>> }
>>
>> public void setMessageline( String name )
>> {
>> messageline = name;
>> }
>>
>> public String getMessageline()
>> {
>> return messageline;
>> }
>>
>>
>> public void processRequest(HttpServletRequest req)
>> throws ServletException, IOException
>> {
>> Hashtable table;
>> String l_msg;
>>
>> if (emailaddr.equals("email"))
>> setMessageline("Submit Email Address");
>> else
>> setMessageline("Else Submit File");
>>
>> // Check if the Form had Multipart/Form-data set
>> l_msg = req.getContentType();
>> if
>> (!req.getContentType().toLowerCase().startsWith("multipart/form-data"))
>> {
>> l_msg = "Wrong content " + req.getContentType();
>> setMessageline(l_msg);
>> !
>> return;
>> }
>>
>> setMessageline("OK");
>> return;
>> }
>> }
>>
>>
>>
>
Re: MULTIPART/FORM-DATA Error.
Posted by Andrew Cockburn <ac...@aqualog.co.uk>.
HI,
I'm not quite sure what you are trying to do here - I have an HTML form that uploads to a servlet running in Tomcat, and that works fine.
I am not sure what you are trying to do with your JSP - it doesn't look like it could work (what is the forms action set to ?) but maybe this is just ignorance on my part.
Andrew
----- Original Message -----
From: Irshad Mungly
To: general@jakarta.apache.org ; acockburn@aqualog.co.uk
Sent: Monday, January 08, 2001 12:32 PM
Subject: Re: MULTIPART/FORM-DATA Error.
Hi Andrew,
I have got the final version on Tomcat 3.2.
I got the program as a servlet but with a JSP it does not work.
Any idea.
Thanks,
Irshad
Andrew Cockburn wrote:
Hi,
Firstly, make sure you are using Tomcat v3.2 with the latest updates - I think there were some problems in earlier versions.
Secondly, take a look at the O'Reilly utility classes - they provide code for doing this. I use it and it works fine with Tomcat 3.2.
You can find it at :
http://www.servlets.com/resources/com.oreilly.servlet/index.html
Good luck,
Andrew
----- Original Message -----
From:Irshad Mungly
To:general@jakarta.apache.org
Sent: Monday, January 08, 2001 7:14 AM
Subject: MULTIPART/FORM-DATA Error.
Hi everyone,I do nt know if it is at this list that I was supposed to send this message.I am new to JSP and Tomcat. I need to write a JSP and Java Bean to uploada file to the server. I wrote a HTML FORM to accept the file name. (below).When I used "multipart/form-data" in the form I get a servlet error.Can anyone help or point me to some other link for help.Thanks.--------------- HTML FILE f1.html:<FORM ENCTYPE="multipart/form-data" method="post" action="f2.jsp"> Your Name <input type="TEXT" name="username" &g!
t; <br> Email <input type="TEXT" name="emailaddr" > <br> File Name <input type="FILE" name="filename" > <br> <input type="submit" value="Submit"> <input type="reset" value="Reset">--></FORM>--------------- JSP FILE f2.jsp:<%@ page import="FileUpload.fup" %><jsp:useBean id="mybean" scope="page" class="FileUpload.fup" /><jsp:setProperty name="mybean" property="*" /><% mybean.processRequest(request); %><FORM ENCTYPE="multipart/form-data" method="post"> Your Name. <input type="text" name="username" size="50"> <br> Email . <input type="text" name="emailaddr" size="50"> <br> File Name. <input type="file" name="filename" size="50"> <br> <input type="submit" value="Submit"> <input type="reset" value="Reset"></FORM>--------------- fu!
p.java:package FileUpload;import java.io.*;import java.util.Hashtable;import java.util.Enumeration;import javax.servlet.*;import javax.servlet.http.*;import java.util.Random;public class fup extends HttpServlet{ private String username; private String filename; private String emailaddr; private String messageline; // By default, 1Mb max file size per file; protected int MaxSize = 1024*1024*1; // 1MB public fup() { username = null; filename = null; emailaddr = null; messageline =null; } public void setUsername( String name ) { username = name; } public void setFilename( String name ) { filename = name; } public void setEmailaddr( String name ) { emailaddr = name; } public String getUsername() { return usern!
ame; } public String getFilename() { return filename; } public String getEmailaddr() { return emailaddr; } public void setMessageline( String name ) { messageline = name; } public String getMessageline() { return messageline; } public void processRequest(HttpServletRequest req) throws ServletException, IOException { Hashtable table; String l_msg; if (emailaddr.equals("email")) setMessageline("Submit Email Address"); else setMessageline("Else Submit File"); // Check if the Form had Multipart/Form-data set l_msg = req.getContentType(); if (!req.getContentType().toLowerCase().startsWith("multipart/form-data")) { l_msg = "Wrong content " + req.getContentType(); setMessageline(l_msg); !
return; } setMessageline("OK"); return; }}
Re: MULTIPART/FORM-DATA Error.
Posted by Irshad Mungly <ir...@celsoft.co.za>.
Hi Andrew,
I have got the final version on Tomcat 3.2.
I got the program as a servlet but with a JSP it does not work.
Any idea.
Thanks,
Irshad
Andrew Cockburn wrote:
> Hi,
>
>
>
> Firstly, make sure you are using Tomcat v3.2 with the latest updates -
> I think there were some problems in earlier versions.
>
>
>
> Secondly, take a look at the O'Reilly utility classes - they provide
> code for doing this. I use it and it works fine with Tomcat 3.2.
>
>
>
> You can find it at :
>
>
>
> http://www.servlets.com/resources/com.oreilly.servlet/index.html
>
>
>
> Good luck,
>
>
>
> Andrew
>
> ----- Original Message -----
>
> From:Irshad Mungly <ma...@celsoft.co.za>
>
> To:general@jakarta.apache.org <ma...@jakarta.apache.org>
>
> Sent: Monday, January 08, 2001 7:14 AM
>
> Subject: MULTIPART/FORM-DATA Error.
>
>
> Hi everyone,
>
> I do nt know if it is at this list that I was supposed to send
> this message.
> I am new to JSP and Tomcat. I need to write a JSP and Java Bean to
> upload
> a file to the server. I wrote a HTML FORM to accept the file name.
> (below).
>
> When I used "multipart/form-data" in the form I get a servlet error.
>
> Can anyone help or point me to some other link for help.
>
> Thanks.
>
>
>
> --------------- HTML FILE f1.html:
> <FORM ENCTYPE="multipart/form-data" method="post" action="f2.jsp">
> Your Name <input type="TEXT" name="username" > <br>
> Email <input type="TEXT" name="emailaddr" > <br>
> File Name <input type="FILE" name="filename" > <br>
> <input type="submit" value="Submit">
> <input type="reset" value="Reset"></FORM>
>
>
> --------------- JSP FILE f2.jsp:
>
> <%@ page import="FileUpload.fup" %>
> <jsp:useBean id="mybean" scope="page" class="FileUpload.fup" />
> <jsp:setProperty name="mybean" property="*" />
> <% mybean.processRequest(request); %>
> <FORM ENCTYPE="multipart/form-data" method="post">
> Your Name. <input type="text" name="username" size="50"> <br>
> Email . <input type="text" name="emailaddr" size="50"> <br>
> File Name. <input type="file" name="filename" size="50"> <br>
> <input type="submit" value="Submit">
> <input type="reset" value="Reset">
> </FORM>
>
> --------------- fup.java:
>
> package FileUpload;
>
> import java.io.*;
> import java.util.Hashtable;
> import java.util.Enumeration;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.util.Random;
>
> public class fup extends HttpServlet
> {
>
> private String username;
> private String filename;
> private String emailaddr;
> private String messageline;
>
> // By default, 1Mb max file size per file;
> protected int MaxSize = 1024*1024*1; // 1MB
>
> public fup()
> {
> username = null;
> filename = null;
> emailaddr = null;
> messageline =null;
> }
>
> public void setUsername( String name )
> {
> username = name;
> }
>
> public void setFilename( String name )
> {
> filename = name;
> }
>
> public void setEmailaddr( String name )
> {
> emailaddr = name;
> }
>
> public String getUsername()
> {
> return username;
> }
>
> public String getFilename()
> {
> return filename;
> }
>
> public String getEmailaddr()
> {
> return emailaddr;
> }
>
> public void setMessageline( String name )
> {
> messageline = name;
> }
>
> public String getMessageline()
> {
> return messageline;
> }
>
>
> public void processRequest(HttpServletRequest req)
> throws ServletException, IOException
> {
> Hashtable table;
> String l_msg;
>
> if (emailaddr.equals("email"))
> setMessageline("Submit Email Address");
> else
> setMessageline("Else Submit File");
>
> // Check if the Form had Multipart/Form-data set
> l_msg = req.getContentType();
> if
> (!req.getContentType().toLowerCase().startsWith("multipart/form-data"))
> {
> l_msg = "Wrong content " + req.getContentType();
> setMessageline(l_msg);
> return;
> }
>
> setMessageline("OK");
> return;
> }
> }
>
>
>
Re: MULTIPART/FORM-DATA Error.
Posted by Andrew Cockburn <ac...@aqualog.co.uk>.
Hi,
Firstly, make sure you are using Tomcat v3.2 with the latest updates - I think there were some problems in earlier versions.
Secondly, take a look at the O'Reilly utility classes - they provide code for doing this. I use it and it works fine with Tomcat 3.2.
You can find it at :
http://www.servlets.com/resources/com.oreilly.servlet/index.html
Good luck,
Andrew
----- Original Message -----
From: Irshad Mungly
To: general@jakarta.apache.org
Sent: Monday, January 08, 2001 7:14 AM
Subject: MULTIPART/FORM-DATA Error.
Hi everyone,I do nt know if it is at this list that I was supposed to send this message.I am new to JSP and Tomcat. I need to write a JSP and Java Bean to uploada file to the server. I wrote a HTML FORM to accept the file name. (below).When I used "multipart/form-data" in the form I get a servlet error.Can anyone help or point me to some other link for help.Thanks.--------------- HTML FILE f1.html:<FORM ENCTYPE="multipart/form-data" method="post" action="f2.jsp"> Your Name <input type="TEXT" name="username" > <br> Email <input type="TEXT" name="emailaddr" > <br> File Name <input type="FILE" name="filename" > <br> <input type="submit" value="Submit"> <input type="reset" value="Reset"></FORM>--------------- JSP FILE f2.jsp:<%@ page import="FileUpload.fup" %><jsp:useBean id="mybean" scope="page" class="FileUpload.fup" /><jsp:setProperty name="mybean" property="*" /><% mybean.processRequest(request); %><FORM ENCTYPE="multipart/form-data" method="post"> Your Name. <input type="text" name="username" size="50"> <br> Email . <input type="text" name="emailaddr" size="50"> <br> File Name. <input type="file" name="filename" size="50"> <br> <input type="submit" value="Submit"> <input type="reset" value="Reset"></FORM>--------------- fup.java:package FileUpload;import java.io.*;import java.util.Hashtable;import java.util.Enumeration;import javax.servlet.*;import javax.servlet.http.*;import java.util.Random;public class fup extends HttpServlet{ private String username; private String filename; private String emailaddr; private String messageline; // By default, 1Mb max file size per file; protected int MaxSize = 1024*1024*1; // 1MB public fup() { username = null; filename = null; emailaddr = null; messageline =null; } public void setUsername( String name ) { username = name; } public void setFilename( String name ) { filename = name; } public void setEmailaddr( String name ) { emailaddr = name; } public String getUsername() { return username; } public String getFilename() { return filename; } public String getEmailaddr() { return emailaddr; } public void setMessageline( String name ) { messageline = name; } public String getMessageline() { return messageline; } public void processRequest(HttpServletRequest req) throws ServletException, IOException { Hashtable table; String l_msg; if (emailaddr.equals("email")) setMessageline("Submit Email Address"); else setMessageline("Else Submit File"); // Check if the Form had Multipart/Form-data set l_msg = req.getContentType(); if (!req.getContentType().toLowerCase().startsWith("multipart/form-data")) { l_msg = "Wrong content " + req.getContentType(); setMessageline(l_msg); return; } setMessageline("OK"); return; }}