日期:2014-05-18  浏览次数:20636 次

谁有支持中文的jspsmartupload.jar呀?急,在线等
不过下载的文件只要是中文文件名的在保存的时候就出现乱码,所以想要个支持中文文件名的jspsmartupload.jar,非常感谢。

谁有请发我的邮箱glokbonc@126.com

收到后马上就会结贴

------解决方案--------------------
给你发了 查收
------解决方案--------------------
我有
我发给你
------解决方案--------------------
其实下载的时候可以不用 jspsmartupload.

接收到下载的请求后,执行一下下边的这段代码。也可以实现下载:


String filePath = "/文件夹1/文件夹2/JAVA教程.doc ";
String fileName = "JAVA教程 ";
String serverPath = request.getRealPath( " ");


response.setContentType( "APPLICATION/OCTET-STREAM ");
response.setHeader( "Content-disposition ", "attachment;filename= " + new String(fileName.getBytes(), "iso8859-1 "));

java.io.FileInputStream fileInputStream = null;
PrintWriter out = null;
try {
fileInputStream = new java.io.FileInputStream(serverPath + filePath);
out = response.getWriter();

int i;
while ((i=fileInputStream.read()) != -1) {
out.write(i);
}
} catch(FileNotFoundException fe){
fe.printStackTrace();
System.out.println(errMsg= "file is not exist ");
}
catch (Exception e) {
e.printStackTrace();
System.out.println(errMsg= "download failed ");
} finally{
if(fileInputStream != null)
fileInputStream.close();
if(out != null)
out.close();
}