要得到2个信息,文件名称—> txt_title,文件ur—> tar_content(已经解决)
<form role="form" enctype="multipart/form-data" method="post" action="index.php?do=suggest" id = "subSuggest" name = "subSuggest">
<input type="hidden" name="formhash" id="formhash" value="{FORMHASH}">
<div class="form-group">
<label class="control-label" for="tar_content">营业执照图片:</label>
<div id="picker">上传图片</div>
<input type="hidden" name="fileid" id="fileid" >
<input type="hidden" name="tar_content" id="tar_content" class="form-control" value="{$arrSuggestInfo['licen_pic']}">
<img id="license_img" src="{$arrSuggestInfo['licen_pic']}" {if !$arrSuggestInfo['licen_pic']}style="display:none"{/if} width="200">
</div>
</form>
<script type="text/javascript" src="static/js/webuploader/webuploader.js?r={RANDOM_PARA}"></script>
<script type="text/javascript" src="static/js/webuploader/kppw.webuploader.js"></script>
<script type="text/javascript">
var uploadsize = parseInt("{$basic_config['max_size']}");
uploadsize = isNaN(uploadsize)? 1 : uploadsize;
$(function(){
$("#picker").KKUploader({
accept: {
extensions : '{$strExtTypes}' //可上传文件格式
},
fileNumLimit:1, //上传数量限制
hiddenName:'fileid', //表单隐藏域id
uploadEvents: {
uploadComplete:function(file){
var url = $("#"+file.id).find('.webuploader-pick-file-close').attr('data-fileurl');
$("#license_img").show();
$("#tar_content").val(url);//$("#filepath").val(url);
$('#license_img').prop('src',url);
$('.webuploader-pick-file-close').on('click','.close',function(){
$("#license_img").hide();
});
}
},
separator:',', //多文件上传时,指定分隔符,如不指定,默认为","
fileSingleSizeLimit:uploadsize*1024*1024 //上传大小限制
},
{
filename : 'file',//传递给服务端的参数指定上传文本域的name,如果未指定,上传不成功
}
);
});
</script>