- <%
- String filename = request.getParameter("filename");
- String pathBuffer=request.getRealPath("//");
- String filepath = pathBuffer+"//filesFloder//"+request.getParameter("filepath");
- int i = 0;
- response.setContentType("application/x-download");
- response.setHeader("Content-Disposition","attachment;filename=/""+java.net.URLEncoder.encode(filename,"UTF-8")+"/"");
- response.setCharacterEncoding("ISO-8859-1");
- java.io.FileInputStream fileInputStream=null;
- try{
- fileInputStream = new java.io.FileInputStream(filepath+filename);
- }catch(Exception e){
- }
- while(fileInputStream!=null && (i= fileInputStream.read()) != -1){
- out.write(i);
- }
- out.flush();
- %>