This is many years ago to do the previous section of the time encountered the problem today suddenly thought of this problem so took out to record
<! DOCTYPE html><html>
<head>
<title>Image upload</title>
<script src="http://www.imooc.com/data/jquery-1.8.2.min.js" type="text/javascript"></script>
</head>
<style type="text/css">
.upload{
display: none;
}
.addImg{
width:50px;
height:50px;
border:1px solid #ddd;
display:inline-block;
text-align: center;
line-height: 50px;;
}
</style>
<body>
<div>
<ul>
<li class="addImg">+</li>
</ul>
<div class="upload">
<input type="file" id="pickfiles"/>
</div>
</div>
</body>
<script type="text/javascript" src="js/plupload.full.min.js"></script>
<script type="text/javascript" src="js/qiniu.min.js"></script>
<script type="text/javascript" src="js/moxie.js"></script>
<script type="text/javascript" src="js/uoload.js"></script>
<script type="text/javascript">
$(function(){
var _this;
var uploadtoken = ' ';
$('.addImg').on('click'.function(e){
_this = e.target;
$('#pickfiles').trigger('click')
})
loadImgUseQiNiu('pickfiles',uploadtoken,function(sourceLink){
var length = $('img_list').length;
if(length>5){
alert('No more than 5 sheets')
return false;
}
var html = '<li class="img_list"><img src="+sourceLink+"/></li>'; _tihs.before(html); })})</script>
</html>
Copy the code