single.php
999 Bytes
<div id="uploader_<?=$id?>">
<!--用来存放item-->
<div class="uploader-list"></div>
<div id="filePicker_<?=$id?>">选择图片</div>
</div>
<input id="uploaded_<?=$id?>" type="hidden" name="<?=$name?>" value="<?=$value?>" />
<script>
var uploadConfig = {
wrap: '#uploader_<?=$id?>',
pick: '#filePicker_<?=$id?>',
/**
* 图片上传成功后在form表单中的hidden元素记录图片
* @param {type} file
* @param {string} response ajax上传返回信息
*/
uploadSuccess: function(file , response){
if (typeof response != 'object'){
response = eval('('+response+')');
}
var images = response.data;
$('#uploaded_<?=$id?>').val(images.uri);
}
};
</script>
<script src="/js/webuploader/webuploader.min.js" charset="UTF-8" type="text/javascript"></script>
<script src="/js/uploadsingle.js" charset="UTF-8" type="text/javascript"></script>