Home > php教程 > PHP源码 > uploadify+PHPExcel无刷新导入数据-完善中1

uploadify+PHPExcel无刷新导入数据-完善中1

WBOY
Release: 2016-06-16 08:39:35
Original
931 people have browsed it
跳至 [1] [全屏预览]
<!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>
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template