Hi Woody,
HTH.
These are some of the responses I got (apologies about not citing
references, check the archives if needed; I don't mean to discredit
the authors in any way)
---We did something like this by using a form tag like
<form action="upload.jsp" enctype="MULTIPART/FORM-DATA">
The JSP page gets a document of the multipart/form-data MIME type,
which the page can read by getting the input stream for the
request. We wrote a separate method to parse the multipart/form-data,
(including processing any other fields that were on the form),
and store the file contents in an actual file on the server.
--You need to change the form encodeing to "multipart/form-data" data,
e.g.:
<form name=new_file enctype="multipart/form-data" method=post
action="upload.jsp">
<input type=file name="File1">
</form>
In the "upload.jsp" you can use the MultipartRequest class that was written
by oreilly and is free for download from their site. It works great.
--Check out the o'reilly servlet book, or go to www.servlets.com - they have
a servlet that will do this, and the source code is available so you can
beef it up if you wish.
::ja
---------
Cheers,
Joe
----- Original Message -----
From: "Amornkul, Woody" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 06, 2000 3:24 PM
Subject: HELP: How to redirect to a file?
> Hi,
> With CGI, I can redirect the browser to a new file by the
following
> two lines:
>
> printf("HTTP/1.0 302 Found\n");
> printf("Location: <path/filename>\n");
>
> The save box will appear to allow me to save the file.
>
> Can this be done with Java Servlet?
> I tried the following codes but it displays the content to the
> broswer instead.
>
> res.setStatus(res.SC_MOVED_TEMPORARILY);
> res.setHeader("Location", site);
>
> Thank you in advance,
> Woody
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> FAQs on JSP can be found at:
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html