Mattias,

If you want to load the file through JSP I can help.  You'll need
to have the following within the JSP:

<form method="POST" (get won't work as well, action="your-servlet"
enctype="multipart/form-data">

<input type="file" name="whatever" />

The only drawback to this is that you can't do the request.getParameter("")
thing.  When the servlet receives this request in, it treats it as
a massive ascii file.  You can then parse it to you hearts content.  If
you have other fields within the JSP, you'll have to treat them the same
way.

Erik

> Delivered-To: [EMAIL PROTECTED]
> Date: Thu, 4 Apr 2002 09:53:14 +0200
> From: "Nilsson, Mattias" <[EMAIL PROTECTED]>
> Subject: File Upload To Servlet?
> To: [EMAIL PROTECTED]
>
> Hello,
>
> Is it possible to upload a file to a servlet on a server? I want to parse
> the file etc. in the servlet. How do I do it? Is there some other, better
> way to solve this?
>
> Please give me some code...
>
> /Mattias
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

------------------------------------------------------

Erik Lorimor           _/_/_/_/  _/_/_/_/   _/_/_/_/
SRS Ops "Tool Guy"    _/        _/     -/  _/
303.272.8109 x78109  _/        _/     -/  _/
cell: 720.209.6961   _/_/_/_/  _/-/-/-/   _/_/_/_/
fax:  303.272.8979        _/  _/   -/          _/
                         _/  _/    -/         _/
                  _/_/_/_/  _/     -/  _/_/_/_/
                  S U N  M I C R O S Y T E M S, I N C.
                  S U N  R E M O T E  S E R V I C E S

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to