//程序没有什么问题
serverFilePath=路径+文件名
File file=new File(serverFilePath);
formitem.write(file);但是中文名都是乱码,文件里的内容是正确的,我JSP页面都设置了utf-8
是不是我的文件名还要在转换一下?
serverFilePath=路径+文件名
File file=new File(serverFilePath);
formitem.write(file);但是中文名都是乱码,文件里的内容是正确的,我JSP页面都设置了utf-8
是不是我的文件名还要在转换一下?
另外,commons-fileupload-1.1使用resquest.setCharsetEnconding("utf-8")也可以
new String(fileName.getByte("gbk"),"utf-8")
imageFileName:文件名String imageName = imageFileName.substring(0, imageFileName
.lastIndexOf("."))
+ UUID.randomUUID().toString();
// 上传:
String s=imageName
+ imageFileName.substring(imageFileName.lastIndexOf("."), imageFileName.length();FileUtils.copyFile(image, new File(path+ "uipconfig/fileUpload",new String(s
.getByte("gbk"),"utf-8")))); 我给文件名加上那种 转码了但是还是不行。