我觉得最好用的上传插件
js调用方法###
$("#fileuploader").uploadFile({
url: "/index.php?_m=util&_a=upload",
fileName: "myfile",
doneStr: "上传完成",
dragDrop: true,
multiple: false,
showDone: true,
uploadStr: "上传",
showDelete: true,
statusBarWidth: 600,
deletelStr: '删除',
cancelStr: "取消",
returnType: 'json',
maxFileCountErrorStr: "不被允许,允许的最大数量为",
dragDropStr: "<span><b>试试拖动文件上传</b></span>",
extErrorStr: "类型不允许,允许类型如下:",
multiDragErrorStr: '这里只能一次上传一张',
customErrorKeyStr: '上传发生了错误',
onSuccess: function (files, res, xhr, pd) {
var data = res.data;
var file = data[0];
$('#fileuploader').after("<input id='" + file.md5 + "' type='hidden' name='attachment[]' value='" + file.savepath + "'/>");
},
deleteCallback: function (data, pd) {
var data = data.data;
var file = data[0];
var md5 = file.md5;
$('#' + md5).remove();
pd.statusbar.hide(); //You choice.
}
});