日期:2014-05-16 浏览次数:20441 次
<input class="jqfileupload" type="file" name="file[]" data-url="@Url.Action("UpLoad","Company")" accept="image/png, image/gif, image/jpg, image/jpeg" multiple>
function jqfileupload(objs) {
objs.fileupload({
data: 'json',
done: function (e, data) {
alert('asdf');
jQuery.each(data.result.files, function (index, file) {
alert(file.name);
});
},
fail: function (e, data) {
jQuery.alerts.dialogClass = 'alert-danger';
jAlert("文件上传失败", "上传失败", function () {
jQuery.alerts.dialogClass = null; // reset to default
});
jQuery('.fileuploadprocess', data.context.parent()).remove();
data.context.html('<i class="iconfa-off"></i>重新上传');
data.context.show();
return false;
},
process: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
jQuery('.bar', data.context.parent()).css(
'width',
progress + '%'
);
},
add: function (e, data) {
alert(data);