掉了稍多坑,终于是能正常上传图片和保存了(gif的格式暂时存储成了jpg,现在只考虑静态图片部分),先上丑丑的效果图,点击图上的“+”号可以新增
后台存储图片路径pfb/UploadFiles:
一、前端页面+CSS文件+js文件:选择图片后,将图片转成流通Ajax去请求后台(这里传入图片类型,用来区分是png还是jpg或者其他文件)
1、html:和jq相关的库网上可以下载
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>图片上传测试</title>
<link href="upload2/demo.css" rel="stylesheet"/>
<link rel="Shortcut icon" href="http://www.jq22.com/favicon.ico" />
<script src="jq/jquery.min.js"></script>
<script src="upload2/jquery.qrcode.min.js"></script>
<script src="upload2/compressFile.js"></script>
<style>
body{ background:#FFF;padding:10px;}
p { text-indent:2em; }
font-test { color:#F00; }
.div-contract { height: 80px;}
.div-content { }
.inpt{ border:none;border-bottom:1px solid #999;}
.inpt-red { border:none; border-bottom:1px solid #F00}
.noborder { border:none; }
.bold { font-weight:bold }
</style>
</head>
<body>
<div class ="body-div-all">
<font style="color:#FF0000">测试</font>
<div class = "div-contract">
<table class = "noborder" align="left">
<tr >
<td class = "bold" align="left">测试编号:<input type="text" name="contractCode" class="inpt"></td>
</tr>
<tr >
<td class = "bold" align="left">测试地点:<input type="text" name="contractSignPlace" class="inpt"></td>
</tr>
<tr >
<td class = "bold" align="left">测试时间:<input type="text" name="contractSignYear" class="inpt">年
<input type="text" name="contractCode" class="inpt">月
<input type="text" name="contractSignDay" class="inpt">日</td>
</tr>
</table>
</div>
<!--开始-->
<div style = " display:block;">
<div>
<input type="file" style="display: none" name="input_0" accept