我想实现简单的上传图片,现在,文件已经上传到服务器了,但是,不能显示,用ACDSee可以打开,而且显示正常.但是用windows自带的打不开,提示没有预览,上传到文件夹中也没有预览显示.请各位指点下,关键代码如下:jsp调用                  request.setCharacterEncoding("utf-8"); //设置请求编码方式
response.setCharacterEncoding("utf-8"); //设置输入编码方式
String type = request.getParameter("type");
String svpath = getServletContext().getRealPath("/");
String path = "images/";
if(type != null && type.equals("getFileList")){ //获取文件列表
UpFile upfile = new UpFile();
String names = upfile.getFileList( svpath+path, "gif;jpg;png;" );
out.print(path+"@"+names);
}else{//上传文件
UpFile upfile = new UpFile( svpath+path, request.getInputStream() );
String newName = upfile.getFileUpload();
System.out.println("名称:" + upfile.getFileName());
        System.out.println("路径:" + upfile.getFilePath());  
        System.out.println("扩展名:" + upfile.getFileReam());  
        System.out.println("上传到路径:"+svpath+path);
        out.print("<IMG width=200 height=200 src='images/"+newName+"'/>");    
}Java 上传代码/**
 * 取得文件信息.
 * @throws Exception
 */
private void getParameter() throws Exception {
byte[] b = new byte[1024];
in.readLine(b, 0, b.length);// 依次是读取属性的开始符、名称、属性值的类型、属性的值
String si = new String((new String(b)).getBytes("ISO-8859-1"), "utf-8");
startStr = si.trim();
in.readLine(b, 0, b.length); // 文件属性
String fileString = new String((new String(b)).getBytes("ISO-8859-1"),
"utf-8");
String files = fileString.substring(
fileString.indexOf("filename=") + 10, fileString.length());
for (int i = 0; i < files.length(); i++) {
if (files.charAt(i) == '\"') {
files = files.substring(0, i);
for (i = files.length() - 1; i > 2; i--) {
if (files.charAt(i) == '\\') {
this.path = files.substring(0, i + 1);
this.name = files.substring(i + 1, files.length()); // \
this.ream = this.name.substring(this.name.indexOf("."),
this.name.length()).toLowerCase();
return;
}
}
}
}
in.readLine(b, 0, b.length); // 类型
in.readLine(b, 0, b.length); // 空
}
/**
 * 上传文件
 * @return 新的文件名
 * @throws Exception
 */
public String getFileUpload()
throws Exception {
int l = 0;
byte[] b = new byte[1024];
String filename = new SimpleDateFormat("yyyy.MM.dd.mm.hh.ss.ms")
    .format(new Date());
String path = fpath + filename + ream;
File fi = new File(path);
if (!fi.exists() && !fi.createNewFile())
return getFileUpload();
String endStr;
BufferedOutputStream f = new BufferedOutputStream(new FileOutputStream(
fi));
while ((l = in.readLine(b, 0, b.length)) > 0) {
endStr = new String(b);
if (endStr.startsWith(startStr)){
break;
}
f.write(b, 0, l);
f.flush();
}
f.flush();
f.close();
in.close();
return filename+ream;
}