The file I want to read is not in http public directory or in its
subdirectories.
It is in a local directory on server like "c:\my docs\document.doc".
I want to implement similar to a file attachment in hotmail. Any idea ?
Thanks,
Venkat
-----Original Message-----
From: � William Kallander � [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 22, 1999 2:58 PM
To: [EMAIL PROTECTED]
Subject: Reading a document from a html form
You can try this:
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
// Create the Network URL object to which I want to connect
// you may need to tweak this to be the full URL to the file you are
attempting to read
URL location = new URL("sentfile");
// Open the URL via openStream method of URL class into an InputStream
BufferedReader in = new
feredReader(
new InputStreamReader( location.openStream() ) );
String inputLine;
// Simultaneously read in and print
while ((inputLine = in.readLine()) != null) {
out.println(inputLine);
// or you can do some other processing...
out.flush();
}
// Close the InputStream
in.close();
// Always close the output stream as well
out.close();
Good luck,
--Will
------------------------------- __ \/_
William C. Kallander (' \`\
Software Engineer _\, \ \\/
LizardTech, Inc. /`\/\ \\
\ \\
National Building; Suite 200 \ \\/\/_
1008 Western Avenue /\ \\'\
Seattle, Washington 98104 __\ `\\\
206.652.5211 /|` `\\
206.652.0880 (Fax) \\
[EMAIL PROTECTED] \\ ,
------------------------------- `---'
___________________________________________________________________________
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