tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Cronin <...@13-colonies.com>
Subject RE: someone plz help
Date Tue, 07 May 2002 13:40:49 GMT
here's what I use.

  public static void upload
  (
    HttpServletRequest request,
    String uploadFolder    
  ) throws IOException
  {
    String cType = request.getContentType();

    if (cType != null &&
cType.toLowerCase().startsWith("multipart/form-data")) 
    {
	    MultipartRequest multi = new MultipartRequest(request,
uploadFolder);
		  Enumeration files = multi.getFileNames();
		 	if(!files.hasMoreElements())
      {
        throw new IOException("No files upload");
      }
    }
    else
    {
      throw new IOException("Invalid Content type: " + cType);
    }
  }

-----Original Message-----
From: # Lalit Nagpal # [mailto:lalit_tomcat@yahoo.com]
Sent: Tuesday, May 07, 2002 12:03 AM
To: tomcat-user@jakarta.apache.org
Subject: someone plz help



i have set multipart/form-data tag in my html form. i
need to get a form filled in by the visitors and also
an attachment on the same form (file upload). i am
using oreilly classes. problem is when i try to get
data + file on the server using MultipartRequest class
of oreilly i get the error "content type is not
multipart". I am using MultipartRequest class
getParameter function to get the data, and the file
upload works as usual. Any Ideas why this error is
occuring.

Plz help.
Thanx in advance.

=====
# Lalit Nagpal #

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message