<link rel="stylesheet" type="text/css" href="${basepath }/static/ixin/css/uploadify.css">
<script src="${basepath }/static/ixin/js/jquery.uploadify.min.js" type="text/javascript"></script>
$(document).ready(function(){
$('#file_upload').uploadify({
'formData' : {
'token' : token,
},
'fileObjName' : 'file',
'buttonText' : '<i class="glyphicon glyphicon-open"></i>上传',
'buttonClass' : 'upload_access',
'swf' : basepath+'/static/ixin/css/uploadify.swf',
'uploader' : 'http://up.qiniu.com/',
'onUploadSuccess' : function(file,data,response){
var result = eval("("+data+")");
$('#showImage').attr("src",qiniuImageBasePath+result.hash+coverSuffix);
$('#showImage').show();
$("#image_cover").html("<img style='max-width:100px;max-height:200px;' src = '"+qiniuImageBasePath+result.hash+coverSuffix+"'>");
$("#small_prev").show();
//文件长传完成之后,在本地保存一份文件信息的数据
$('#coverPath').val(result.hash);
saveFile(file,result);
}
});
});
<div class="frm_input_box">
<div class="upload_box">
<div class="upload_area">
<input type="file" name="file_upload" id="file_upload" />
<ul class="upload_file_box" style="display: none;" id="queue"></ul>
</div>
</div>
<div style="display: none;margin-bottom:20px;" id="small_prev">
<span id="image_cover"></span><a class="js_removeCover" href="javascript:void(0);" onclick="deleteCover();">删除</a>
</div>
</div>