
byte[] blob = userinfo.getPhoto()
if(blob!=null){
response.reset() response.setContentType("image/"+dat) OutputStream toClient = response.getOutputStream() try {toClient.write(blob) } catch (Exception e) {e.printStackTrace() }finally{toClient.flush() toClient.close() } response.flushBuffer() }
写数据库
byte[] bFile = new byte[(int) files[0].length()]FileInputStream fileInputStream = new FileInputStream(files[0])fileInputStream.read(bFile)fileInputStream.close()userinfo.setPhotoname(photoName[0])userinfo.setPhoto(bFile)
userdao.save(userinfo)
我这个是java的,不知道和你的一不一样
写绝对路径啊ie和firefox 的路径格式不一样。
由于安全机制,IE7+和火狐等浏览器不支持显示本地图片
好像在路径钱加file:///好像就好了
<html>
<body background="file:///D:\\1.png">
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)