bootstrap file input ajax,bootstrap fileinput怎么和ajax一起上传
用户提问
$(function(){ $("#imageUpload").fileinput({ showCaption: false, language: 'zh', enctype: 'multipart/form-data', uploadUrl: '${basePath}fileupload?action=videoUpload', //上传的地址 allowedFileExtensions : ['flv', 'swf', 'mkv', '...
推荐答案
$(function(){
$("#imageUpload").fileinput({
showCaption: false,
language: 'zh',
enctype: 'multipart/form-data',
uploadUrl: '${basePath}fileupload?action=videoUpload', //上传的地址
allowedFileExtensions : ['flv', 'swf', 'mkv', 'avi', 'rm', 'rmvb', 'mpeg', 'mpg', 'ogg', 'ogv', 'mov', 'wmv', 'mp4', 'webm', 'mp3'],//接收的文件后缀
initialPreviewAsData: false //配置上传后是否显示预览
}).on('fileuploaded',
function(event, data, id, index) {
var fname = data.files[index].name;
var out = '
' + '文件 # ' + (index + 1) + ' - ' + fname + ' 已经成功上传.' + '';$('#content').attr("value",data.response.videoUrl);//获得后台返回名为videoUrl的json数据
$('#kv-success-1').append(out);
$('#kv-success-1').fadeIn('slow');