blueimp jQuery文件上载筛选类型和文件大小并发送新参数
我将jQuery插件与以下JS代码一起使用:blueimp jQuery文件上载筛选类型和文件大小并发送新参数,jquery,jquery-plugins,file-upload,filtering,Jquery,Jquery Plugins,File Upload,Filtering,我将jQuery插件与以下JS代码一起使用: $('#file_upload_single').fileupload({ dataType: 'json', acceptFileTypes: /(\.|\/)(gif|jpe?g|tif|png)$/i, maxFileSize: 20000000, // 20MB done: function (e, data) { $.each
$('#file_upload_single').fileupload({
dataType: 'json',
acceptFileTypes: /(\.|\/)(gif|jpe?g|tif|png)$/i,
maxFileSize: 20000000, // 20MB
done: function (e, data) {
$.each(data.result, function (index, file) {
var msg = file.name + " upload terminado.";
$('<p/>').text(msg).appendTo($('#progressLog'));
});
$('#progressBar .bar').css('width','0%');
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progressBar .bar').css('width',progress + '%');
}
});
$('#file_upload_single').bind('fileuploadsubmit', function (e, data) {
var inputs = data.context.find(':input');
if (inputs.filter('[required][value=""]').first().focus().length) {
alert("Por preencher");
return false;
}
data.formData = inputs.serializeArray();
});
bind方法与中的类似。怎么了?我使用了不同的方法来解决附加表单数据的问题。我在“添加”回调中这样做了
add: function (e, data){
data.formData = {customInfo: <custom information>};
data.submit();
},
add:函数(e,数据){
data.formData={customInfo:};
data.submit();
},
这个很好用。但是我不能让过滤器也工作。嗯。。。我用了另一个。
TypeError: data.context is undefined
var inputs = data.context.find(':input');
add: function (e, data){
data.formData = {customInfo: <custom information>};
data.submit();
},