jsp浏览器

源代码在线查看: down.jsp

软件大小: 60 K
上传用户: wangregret2000
关键词: jsp 浏览器
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
								//文件管理系统 V1.0
				//2009-2-17
				//woody_2006@163.com
				String file = new String(request.getParameter("file").getBytes("iso-8859-1"),"GBK");
				String curName = "";
				if(!Tool.isEmp(file))
				{
					String[] tmp = file.split("/");
					if(tmp.length>1)
					{
						curName = tmp[tmp.length-1];
					}
				}
				OutputStream o = response.getOutputStream();
				File fileLoad = new File(file);
				response.reset();
				response.setContentType("application/x-msdownload;charset=gb2312;");
				response.setHeader("content-disposition","attachment;filename="+new String(curName.getBytes("GBK"),"iso8859-1"));
				long fileLength = fileLoad.length();
				String length1 = String.valueOf(fileLength);
				response.setHeader("Content_Length", length1);
				FileInputStream in = new FileInputStream(fileLoad);
				int n;
				byte[] b = new byte[(int)fileLength];
				while ((n = in.read(b)) != -1)
				{
					o.write(b, 0, n);
				}
				in.close();
				o.close();
				%>			

相关资源