• 如何实现一次选择多个文件上传,而且异步上传


    swfupload插件

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    <html xmlns="http://www.w3.org/1999/xhtml"
    <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
      
    <title>File upload </title> 
    <link rel="Stylesheet" href="js/Plug-in/jquery.uploadify/uploadify.css" /> 
    <script type="text/javascript" src="js/Plug-in/jquery.uploadify/jquery-1.3.2.min.js"></script> 
    <script type="text/javascript" src="js/Plug-in/jquery.uploadify/swfobject.js"></script> 
    <script type="text/javascript" src="js/Plug-in/jquery.uploadify/jquery.uploadify.v2.1.0.min.js"></script> 
    <script type="text/javascript"
    $(document).ready(function() { 
        $("#uploadify").uploadify({ 
            'uploader''js/Plug-in/jquery.uploadify/uploadify.swf'
            'script''uploadify.php'
            'cancelImg''js/Plug-in/jquery.uploadify/cancel.png'
            'folder''uploadfile'
            'queueID''fileQueue'
            'auto'false
            'multi'true
        }); 
    }); 
    </script> 
    </head> 
    <body> 
    MAX: 20M
    </BR>
    <input type="file" name="uploadify" id="uploadify" /> 
    <a href="javascript:$('#uploadify').uploadifyUpload()">Upload</a>| <a href="javascript:$('#uploadify').uploadifyClearQueue()">cancel</a> 
    <div id="fileQueue"></div> 
    </body> 
    </html>

    #uploadify.php

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <?php
    if (!empty($_FILES)) {
        $tempFile $_FILES['Filedata']['tmp_name'];
        $targetPath $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
        $targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
        $targetFile =  iconv("utf-8","gbk",$targetFile);
     
            move_uploaded_file($tempFile,$targetFile);
            echo "1";
    }
    ?>
  • 相关阅读:
    iOS技术框架构和更新版本的技术特性
    iOS第三方常用类库
    查看MySQL系统变量的命令
    解决WIN7下VMWARE虚拟机无法上网问题
    MySQL性能优化的最佳20+条经验
    PHP高效率写法(详解原因)
    google官方建议使用的网站性能测试工具
    ETL工具-KETTLE教程 实例实战4----转换(值映射、列转行,增加常量、增加序列等)
    ETL工具-KETTLE教程实例实战2----环境介绍
    ETL工具-KETTLE教程实例实战1----术语和定义
  • 原文地址:https://www.cnblogs.com/zxz1987/p/6524059.html
Copyright © 2020-2023  润新知