You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

$(document).ready(function(){
//解决file的change事件只能执行一次的问题
$(document).on('change','#upload',function(){
ajaxFileUpload();
});
});
//上传图片的方法,
function ajaxFileUpload(){
//获得basePath
basePath=$('#basePath').val();
//调用ajaxfileupload.js中的方法
$.ajaxFileUpload({
url:'admin/fileUploadAction_fileUpload.action',//上传要提交到的action
secureuri:false,//是否用安全提交默认为false
fileElementId:'upload',//file选择文件的框的id
dataType:'json',//数据返回格式如果用json需要修改ajaxfileupload.js中的内容 eval("data = " + data ); -->data = jQuery.parseJSON(jQuery(data).text());
success: function (data){
if(data.state=="success"){
$("#excel").val(data.path);
}else{
showInfo("上传的格式有误!!");
}
}
});
}
function showInfo(msg) {
$("#div_info").text(msg);
$("#modal_info").modal('show');
}