一、提交表单:
function listUploadFileText(id,fileType,fileTextCategory){
//执行修改
$.post("scb/fileTextInfo.action",{
approvalMaterialId:id,fileCategory:fileTextCategory
},function(data,status){
//alert(data);
showFileTextList(data);
},'json');
}
二、上传附件:
function selFileUpload(baseid,fileUploadCategory){
//判断上传材料的合法性
$("#subUploadTextFileId").val($("#formatTextFileId").val()); //formatTextFileId为附件file文本的ID,subUploadTextFileId为隐藏域的ID
if($.trim($("#subUploadTextFileId").val())!="" && $("#subUploadTextFileId").val()!="null"){
var ext = GetExtensionFileName($("#subUploadTextFileId").val()); //GetExtensionFileName,得到文件的后缀名
if( !(ext == "doc" || ext == "docx" || ext=="xlsx" || ext=="xls" || ext=="jpg" || ext=="gif" || ext=="pdf")){
alert("上传文件格式错误,只能上传doc、docx、xlsx、xls、jpg、gif、pdf文档!");
return false;
}
}
urlAction='scb/fileText.action?textFileCategory='+fileUploadCategory+'&sysFileTextId='+sysUpFileTextId;
}
fileNameId="formatTextFileId";
$.ajaxFileUpload(
{
url:urlAction, //需要链接到服务器地址
secureuri:false,
fileElementId:fileNameId, //文件选择框的id属性
dataType:'json', //服务器返回的格式
success: function (data,status) //回调会值
//相当于java中try语句块的用法
{
//alert(data); //对象
if(status == 'success'){
addFileBack(data);
}else{
alert(data.error);
}
},
error: function (data, status, e){ //相当于java中catch语句块的用
// alert("222.");
alert(e);
}
}
);
}