Fine Uploader 3.6.4开箱即用?

时间:2013-06-15 02:40:13

标签: javascript fine-uploader

here下载了fineuploader v 3.6.4,创建了一个简单的测试页面(几乎与您的演示here完全相同)并在fineuploader-3.6.4上获得TypeError:Object <...> has no method '_handleCameraAccess'的.js:1233

我错过了什么吗?我在您的网站上看不到任何其他说明......

Uncaught TypeError: Object function (element) {
"use strict";

return {
    hide: function() {
        element.style.display = 'none';
        return this;
    },

    /** Returns the function which detaches attached event */
    attach: function(type, fn) {
        if (element.addEventListener){
            element.addEventListener(type, fn, false);
        } else if (element.attachEvent){
            element.attachEvent('on' + type, fn);
        }
        return function() {
            qq(element).detach(type, fn);
        };
    },

    detach: function(type, fn) {
        if (element.removeEventListener){
            element.removeEventListener(type, fn, false);
        } else if (element.attachEvent){
            element.detachEvent('on' + type, fn);
        }
        return this;
    },

    contains: function(descendant) {
        // compareposition returns false in this case
        if (element === descendant) {
            return true;
        }

        if (element.contains){
            return element.contains(descendant);
        } else {
            /*jslint bitwise: true*/
            return !!(descendant.compareDocumentPosition(element) & 8);
        }
    },

    /**
     * Insert this element before elementB.
     */
    insertBefore: function(elementB) {
        elementB.parentNode.insertBefore(element, elementB);
        return this;
    },

    remove: function() {
        element.parentNode.removeChild(element);
        return this;
    },

    /**
     * Sets styles for an element.
     * Fixes opacity in IE6-8.
     */
    css: function(styles) {
        if (styles.opacity != null){
            if (typeof element.style.opacity !== 'string' && typeof(element.filters) !== 'undefined'){
                styles.filter = 'alpha(opacity=' + Math.round(100 * styles.opacity) + ')';
            }
        }
        qq.extend(element.style, styles);

        return this;
    },

    hasClass: function(name) {
        var re = new RegExp('(^| )' + name + '( |$)');
        return re.test(element.className);
    },

    addClass: function(name) {
        if (!qq(element).hasClass(name)){
            element.className += ' ' + name;
        }
        return this;
    },

    removeClass: function(name) {
        var re = new RegExp('(^| )' + name + '( |$)');
        element.className = element.className.replace(re, ' ').replace(/^\s+|\s+$/g, "");
        return this;
    },

    getByClass: function(className) {
        var candidates,
            result = [];

        if (element.querySelectorAll){
            return element.querySelectorAll('.' + className);
        }

        candidates = element.getElementsByTagName("*");

        qq.each(candidates, function(idx, val) {
            if (qq(val).hasClass(className)){
                result.push(val);
            }
        });
        return result;
    },

    children: function() {
        var children = [],
            child = element.firstChild;

        while (child){
            if (child.nodeType === 1){
                children.push(child);
            }
            child = child.nextSibling;
        }

        return children;
    },

    setText: function(text) {
        element.innerText = text;
        element.textContent = text;
        return this;
    },

    clearText: function() {
        return qq(element).setText("");
    }
};
} has no method '_handleCameraAccess'

qq.FineUploaderBasic fineuploader-3.6.4.js:1233
qq.FineUploader fineuploader-3.6.4.js:2594
createUploader test:14

编辑:

我的代码

<!DOCTYPE html>
<html>
    <head>
        <title>Testing File Uploads</title>
        <link href='../../lib/fineuploader/fineuploader-3.6.4.css' rel='stylesheet' >
    </head>
<body>
        <h1>Upload files test</h1>
        <div id='fineuploaderTest'></div>

        <script src='../../lib/fineuploader/fineuploader-3.6.4.js'></script>
        <script>
            function createUploader() {
                var uploader = qq.FineUploader({
                    element: document.getElementById('fineuploaderTest'),
                    request: {endpoint: 'upload/upload'}
                });
            };

            window.onload = createUploader;
        </script>
    </body>
</html>

1 个答案:

答案 0 :(得分:1)

您尚未复制所引用演示中的确切代码。事实上,你遗漏了一个非常重要的词:new

替换此行:
var uploader = qq.FineUploader({

用这个:
var uploader = new qq.FineUploader({