PlUpload:选择文件夹功能

时间:2016-01-20 10:00:16

标签: javascript plupload

感谢PlUpload库,我想通过窗口对话框上传文件夹。

有可能并解释here。 (搜索“select_folder”)。

然而,在PlUpload website中没有解释。

<html>
<head>
</head>

<body>
    <ul id="filelist"></ul>
    <br />

    <div id="container">
        <a id="browse" href="javascript:;">[Browse...]</a>
        <a id="start-upload" href="javascript:;">[Start Upload]</a>
    </div>


    <script type="text/javascript" src="./js/plupload.full.min.js" ></script>
    <script type="text/javascript">
        var uploader = new plupload.Uploader({
          browse_button: 'browse', // this can be an id of a DOM element or the DOM element itself
          url: 'upload.php',
          select_folder:1, 
          drag_and_drop:0
        });

        uploader.init();
    </script>
</body>

此代码不起作用。那么,它有什么问题呢?

提前致谢:)

祝你有个美好的一天。

1 个答案:

答案 0 :(得分:1)

我不得不使用Moxie对象。

        <body>
            <ul id="filelist"></ul>
            <br />

            <div id="container">
                <a id="browse" href="javascript:;">[Browse...]</a>
                <a id="start-upload" href="javascript:;">[Start Upload]</a>
            </div>


            <script type="text/javascript" src="./js/plupload.full.min.js" ></script>
            <script type="text/javascript">
                var uploader = new plupload.Uploader({
                  url: 'upload.php'
                });
                uploader.init();

                var input = new mOxie.FileInput({
                  browse_button: 'browse',
                    multiple: false,
                    directory: true
                });

                input.init();
            </script>
        </body>