62,046
社区成员
发帖
与我相关
我的任务
分享
//附件上传
function AttachUpload(repath, uppath) {
var submitUrl = "tools/upload_ajax.ashx?action=AttachFile&UpFilePath=" + uppath;
//开始提交
$("#form1").ajaxSubmit({
beforeSubmit: function (formData, jqForm, options) {
//隐藏上传按钮
$("#" + uppath).parent().hide();
//显示LOADING图片
$("#" + uppath).parent().nextAll(".uploading").eq(0).show();
},
success: function (data, textStatus) {
if (data.msg == 1) {
var listBox = $("#" + repath + " ul");
var newLi = '<li>'
+ '<input name="hidFileName" type="hidden" value="0|' + data.mstitle + "|" + data.msgbox + '" />'
+ '<b class="close" title="删除" onclick="DelAttachLi(this);"></b>'
+ '<span class="title">附件:' + data.mstitle + '</span>'
+ '<a href="javascript:;" class="upfile"><input type="file" name="FileUpdate" onchange="AttachUpdate(\'hidFileName\',this);" /></a>'
+ '<span class="uploading">正在更新...</span>'
+ '</li>';
listBox.append(newLi);
} else {
alert(data.msgbox);
}
$("#" + uppath).parent().show();
$("#" + uppath).parent().nextAll(".uploading").eq(0).hide();
},
error: function (data, status, e) {
alert("上传失败,错误信息:" + e);
$("#" + uppath).parent().show();
$("#" + uppath).parent().nextAll(".uploading").eq(0).hide();
},
url: submitUrl,
type: "post",
dataType: "json",
timeout: 600000
});
};