logo.php
1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<div id="uploader">
<!--用来存放item-->
<div class="uploader-list"></div>
<div id="filePicker">选择图片</div>
</div>
<input id="uploaded" type="hidden" name="<?=$name?>" value="<?=$value?>" />
<script>
var disable = function(){
return false;
};
/**
* 上传过程中
*/
function uploadPending(file){
$('#upload_button').bind('click',disable);
}
/**
* 图片上传成功后在form表单中的hidden元素记录图片
* @param {type} file
* @param {string} response ajax上传返回信息
*/
function uploadSuccess(file , response){
if (typeof response != 'object'){
response = eval('('+response+')');
}
var images = response.data;
$('#uploaded').val(images.uri);
$('#upload_button').unbind('click',disable);
}
/**
* 图片上传失败
*/
function uploadFail(file){
$('#upload_button').unbind('click',disable);
}
</script>