android上的多个HTML文件上传控件

multiple html file upload controls on android

本文关键字:文件 控件 HTML android      更新时间:2023-09-26

我有一个网页,需要在IE以及移动工作。在这个页面上我上传了4个文件。为了使页面看起来更现代,它会发送到iframe处理程序。我的问题是,在android上,它只上传第一个文件,而忽略了最后一个。我的代码在

下面
try {
    $('#BtnUpload').html('<i class="fa fa-spinner  fa-spin" aria-hidden="true"></i> Uploading');
    action_url = 'uploader.aspx';
    var iframe = document.createElement("iframe");
    iframe.setAttribute("id", "upload_iframe");
    iframe.setAttribute("name", "upload_iframe");
    iframe.setAttribute("width", "0");
    iframe.setAttribute("height", "0");
    iframe.setAttribute("border", "0");
    iframe.setAttribute("style", "width: 0; height: 0; border: none;");
    // Add to document...
    form.parentNode.appendChild(iframe);
    window.frames['upload_iframe'].name = "upload_iframe";
    iframeId = document.getElementById("upload_iframe");
    // Add event...
    var eventHandler = function() {
        if (iframeId.detachEvent) iframeId.detachEvent("onload", eventHandler);
        else iframeId.removeEventListener("load", eventHandler, false);
        // Message from server...
        if (iframeId.contentDocument) {
            content = iframeId.contentDocument.body.innerHTML;
        } else if (iframeId.contentWindow) {
            content = iframeId.contentWindow.document.body.innerHTML;
        } else if (iframeId.document) {
            content = iframeId.document.body.innerHTML;
        }
        var imagesUpdate = content.split(',');
        for (var x in imagesUpdate) {
            var keyval = imagesUpdate[x].split(':');
            currentuploads[keyval[0]] = keyval[1];
            //console.log(keyval[1]);
        }
        $('#BtnUpload').html('Upload documents');
        hideShowImages();
        // Del the iframe...
        try {
            setTimeout(function() {
                //iframeId.parentNode.removeChild(document.getElementById(iframeId))
                $("#upload_iframe").remove();
                //document.getElementById("upload_iframe").removeChild(document.getElementById("upload_iframe"));
            }, 250);
        } catch (e) {}
    }
    if (iframeId.addEventListener) iframeId.addEventListener("load", eventHandler, true);
    if (iframeId.attachEvent) iframeId.attachEvent("onload", eventHandler);
    // Set properties of form...
    form.setAttribute("target", "upload_iframe");
    form.setAttribute("action", action_url);
    form.setAttribute("method", "post");
    form.setAttribute("enctype", "multipart/form-data");
    form.setAttribute("encoding", "multipart/form-data");
    // Submit the form...
    form.submit();
} catch (e) {
    var err = e.message;
    var isIE10 = false;
    /*@cc_on
        if (/^10/.test(@_jscript_version)) {
            isIE10 = true;
        }
    @*/
    if (err.substring(0, 16) == 'Access is denied' && isIE10) {
        $('#BtnUpload').click();
    }
}

愚蠢的错误,最大文件上传和文件大小没有在web.config中设置。一切正常