image_location是形如/xxxx/image_tmp/2007/6/1/14/的 路径字符串
目的是想 从 /xxxx/image_tmp/2007/6/1/14/或
/xxxx/image_tmp1/2007/6/1/14/路径读取图像
下面这样写行么? String Imagetem= image_location;
String Imagetem1=Imagetem.replace("mage_tmp","mage_tmp1");
File file = new File(String.valueOf(Imagetem).concat(String.valueOf(image_file_name)));
if(file.exists()){
buffer = new byte[(int)file.length()];
FileInputStream in = new FileInputStream(file.getAbsolutePath());
in.read(buffer);
in.close();
}
else{
file =new File(String.valueOf(Imagetem1).concat(String.valueOf(image_file_name)));
buffer = new byte[(int)file.length()];
FileInputStream in = new FileInputStream(file.getAbsolutePath());
in.read(buffer);
in.close();
}
目的是想 从 /xxxx/image_tmp/2007/6/1/14/或
/xxxx/image_tmp1/2007/6/1/14/路径读取图像
下面这样写行么? String Imagetem= image_location;
String Imagetem1=Imagetem.replace("mage_tmp","mage_tmp1");
File file = new File(String.valueOf(Imagetem).concat(String.valueOf(image_file_name)));
if(file.exists()){
buffer = new byte[(int)file.length()];
FileInputStream in = new FileInputStream(file.getAbsolutePath());
in.read(buffer);
in.close();
}
else{
file =new File(String.valueOf(Imagetem1).concat(String.valueOf(image_file_name)));
buffer = new byte[(int)file.length()];
FileInputStream in = new FileInputStream(file.getAbsolutePath());
in.read(buffer);
in.close();
}
解决方案 »
- 高手帮忙,购物车的问题?100分!!!!!!!!
- 服务器选weblogic好,还是选 集成tomcat 好?
- 在jsp中上传好文件以后我想对上传的文件以上传的日期命名??
- ExtJs4 Chart字体设置问题
- 江湖告急,jsp生成图片的问题(由于前贴的给分太少了,重发)
- 在HTML代码中的问题
- 求教用session从一个页面把参数传送到另一页,并取出值的具体方法!
- 求助!java.net.SocketTimeoutException: Read timed out
- HT FOR WEB 新手问题
- 新手求助!!!myeclipse使用XMLWriter的时候,为什么XMLWriter提示构造方法没定义??
- 如何采集名索网数据
- 系统发送带连接的邮件时带{Disarmed} 等字样
你这样不报错吗?而且变量首字母要小写。