download.jsp~3~
资源名称:bangong.rar [点击查看]
上传用户:dlqqsh
上传日期:2021-11-13
资源大小:7840k
文件大小:1k
源码类别:
OA系统
开发平台:
Java
- <%@ page contentType="text/html; charset=GBK" import="com.jspsmart.upload.*" %>
- <% request.setCharacterEncoding("GBK");%>
- <html>
- <head>
- <title>
- download
- </title>
- </head>
- <body bgcolor="#ffffff">
- <h1>
- download
- </h1>
- <%
- //String fn = request.getParameter("fn");
- /*
- out.print(fn+" is being donwloaded!");
- String fnn = (String)session.getAttribute("fna");
- out.print(fnn+" is being downloaded too!");
- session.removeAttribute("fna");*/
- try{
- // 新建一个SmartUpload对象
- SmartUpload su = new SmartUpload();
- // 初始化
- su.initialize(pageContext);
- String fn = request.getParameter("fn");
- out.print(fn);
- if(fn==null){
- out.print("file name is null,please try again!");
- }else{
- // 设定contentDisposition为null以禁止浏览器自动打开文件,
- //保证点击链接后是下载文件。若不设定,则下载的文件扩展名为
- //doc时,浏览器将自动用word打开它。扩展名为pdf时,
- //浏览器将用acrobat打开。
- su.setContentDisposition(null);
- // 下载文件
- su.downloadFile("/upload/"+fn);
- out.clear();
- out = pageContext.pushBody();
- }
- }catch(Exception ex){
- ex.printStackTrace();
- }
- %>
- <a href=FileUpload.html>重新上传</a>
- </body>
- </html>