Have a look at the com.oreilly.servlet.MultipartRequest utility class which
encapsulates the details of the file upload specification (RFC 1867) parsing
available here....

    http://www.servlets.com/resources/com.oreilly.servlet/index.html

An example servlet which uses this utility class is here...

    http://www.servlets.com/jsp/examples/ch04/index.html#ex04_17

Mike


Storm Linux User wrote:

> At 15:00 12.11.00 , you wrote:
> >It's not form commercial use. It's for my research project for getting my
> >master's degree in Electrical Engineering ... I'm not concered about securety
> >right now.
>
> >then hack right on. will be fun. the security aspects of this could easily
> >fill a chapter of your thesis if it fits your topic ;-).
>
> Thanks, Robert.
>
> The problem is that I'm not able to get the file that I uploaded using a HTML
> form like:
>
> <form method="post" action="my_servlet">
> <input type="file" name="my_class_file">
> <input type="submit">
> </form>
>
> How do I get the file in the servlet and make an object of it?
>
> I've tried:
>
> File f = (File)request.getAttribute("my_class_file");
>
> But it does not work. It compiles if I change to:
>
> Object obj = request.getAttribute("my_class_file");
>
> But then, how do I transform an Object to a File, and then, as the file is a
> compiled class, how do I create an instantiate this class to call some
> methods of it?
>
> Thanks again!
> []s
> Guilherme Ceschiatti
> [EMAIL PROTECTED]

--
Mike Clark
Clarkware Consulting
Enterprise Java Architecture, Design, Development
http://www.clarkware.com



Reply via email to