uploadify+PHPExcel无刷新导入数据 1. [代码] [PHP]代码 !DOCTYPE HTMLhtmlhead meta http-equiv="Content-Type" content="text/html; charset=utf-8" title小雨在线-视频上传插件/title script src="//cdn.bootcss.com/jquery/1.7.1/jq
1. [代码][PHP]代码
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>小雨在线-视频上传插件</title> <script src="//cdn.bootcss.com/jquery/1.7.1/jquery.min.js"></script> <script src="jquery.uploadify.min.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="uploadify.css"> </head> <body> <script type="text/javascript"> $(function () { $('#studata').uploadify({ 'auto': false, 'formData': { 'stuid': '1111111111', }, 'buttonText': '请选择上传文件', 'fileSizeLimit': '100MB', 'fileTypeDesc': 'excel文件', 'fileObjName': "studata", 'fileTypeExts': '*.xlsx',//文件类型过滤 'swf': 'uploadify.swf', 'multi': false, 'successTimeout': 1800, 'queueSizeLimit': 100, 'uploader': 'uploadify.php', 'onUploadStart': function (file) { //alert('Starting to upload ' + file.name); //正在上传中... // $('#alert-content').html('正在上传文件'); // modal.modal(); }, //onUploadSuccess为上传完视频之后回调的方法, 'onUploadSuccess': function (file, data, response) { //$('#alert-content').html('正在导入数据'); data = eval("(" + data + ")"); $.ajax({ type: 'POST', url: '../reader.php', dataType: 'html', data: {'exceldir': data.updir}, success: function (retdata) { alert(retdata); //modal.modal('close'); // if(retdata==1){ // alert('导入成功'); // }else{ // alert('导入失败'); // } } }); } }); }); </script> <p><input type="file" value="studata" id="studata"> <input type="button" onclick="javascript:$('#studata').uploadify('upload','*')" value="上传"></p> </body> </html>