[#macro ajaxuploadnew id="" name=id allowTypes="*" fileSizeLimit="5000KB" style="" width="240" height="30"]
|
<script src="${base}/static/plugins/uploadify/jquery.uploadify.min.js" type="text/javascript" charset="UTF-8"></script>
|
<link rel="stylesheet" type="text/css" href="${base}/static/plugins/uploadify/uploadify.css">
|
|
<style>
|
.hid {display:none;}
|
|
.uploadify{
|
position:absolute;bottom:0;left:0;font-size:1px;
|
}
|
|
.uploadify-queue{
|
position:absolute;bottom:10px;left:0;font-size:1px;
|
}
|
</style>
|
|
<script type="text/javascript">
|
$(function() {
|
$("#${id}").uploadify({
|
height : ${height},
|
swf : '${base}/static/plugins/uploadify/uploadify.swf',
|
uploader : '${base}/interface/fileupload/picpressupload.html',
|
buttonClass : 'hid',
|
multi : false,
|
width : ${width},
|
fileTypeExts : '${allowTypes}',
|
fileSizeLimit : '${fileSizeLimit}',
|
queueID : 'abc',
|
onError:function(event,queueId,fileObj,errorObj){
|
if (errorObj.type === "File Size"){
|
alert('³¬¹ýÎļþÉÏ´«´óСÏÞÖÆ£¨2M£©£¡');
|
return;
|
}
|
},
|
onUploadSuccess : function(file, data, response){
|
var data = JSON.parse(data);
|
$("#${id}_TEXT").val(data.FILE_PATH);
|
$("#${id}_IMG").attr("src",'${base}'+data.FILE_PATH);
|
|
var img = new Image();
|
img.src = '${base}'+data.FILE_PATH;
|
img.onload=function(){
|
if(img.width > img.height){
|
$("#${id}_IMG").css("width","100%");
|
$("#${id}_IMG").css("height","");
|
}else{
|
$("#${id}_IMG").css("height","100%");
|
$("#${id}_IMG").css("width","");
|
}
|
|
}
|
|
}
|
});
|
})
|
</script>
|
|
<input type="file" name="${id}" id="${id}" style="${style}"/>
|
[/#macro]
|