Thanks konjeti garu ,
I am doing same way using JSP.
But when i am reading a word doc it was reading junk characters also.
It is not giving proper output.
My code follows:
<%
try{
String filename = request.getParameter("filename");
response.setContentType( "application/msword" );
BufferedReader bis = null;
BufferedWriter bos = null;
try {
bis = new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
bos = new BufferedWriter(out);
char[] buff = new char[4 * 1024]; // 4K buffer
int bytesRead;
while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
}
finally {
if (bis != null) bis.close();
}
}
catch (FileNotFoundException e) {
out.println("File not found: ");
}
catch (IOException e) {
out.println("Problem sending file " + ": " + e.getMessage());
}
%>