Plupload不能在ipad上工作

Plupload not working in ipad

本文关键字:工作 ipad 不能 Plupload      更新时间:2023-09-26

我使用Plupload在我的网站上传图像。它在所有桌面浏览器上都很好用,但在i-pad上不行。当我点击上传按钮,它刷新页面。我搜索了一下,没有找到任何可以修复它的东西。最后,我在这里提出我的问题。我正在使用pl上传Core Api。

下面是我的代码:
var uploader = new plupload.Uploader({
        runtimes : 'html5,flash,silverlight,html4',
        browse_button : 'local_file_upload', // you can pass an id...
        container: document.getElementById('container'), // ... or DOM Element itself
        url : "<?php echo WEBSITE_URL . '/includes/upload.php';?>",
        unique_names : true,
        multi_selection: false,
        max_file_count: 1,
        flash_swf_url : pl_upload_url+'Moxie.swf',
        silverlight_xap_url : pl_upload_url+'/Moxie.xap',
        filters : {
            max_file_size : '10mb',
            mime_types: [
                {title : "Image files", extensions : "jpg,gif,png,jpeg"},
            ]
        },
        init: {
            PostInit: function() {
                document.getElementById('filelist').innerHTML = '';
     
                document.getElementById('upload_images').onclick = function() {
                    uploader.start();
                    jQuery("#upload_images").css("display","none");
                    return false;
                };
            },
            FileUploaded: function (up, file) {
                if(image_path != "")
                {
                    jQuery("#filelist").css("display","none");
                    var ajaxURL = "../includes/ajax.php";
                    jQuery.post(ajaxURL,"image_path="+image_path+"&ajax=true&action=uploadImage",function(data)
                    {
                        jQuery("#preview_image").html("<img src='<?php echo WEBSITE_URL.'/uploads/users/'.$user_id.'/thumbnail/'?>"+file.target_name+"' style='width:100%'/>");
                    });
                }
                else
                {
                    alert("<?php echo _("Kinldy select image to upload");?>");
                }
            },
            FilesAdded: function(up, files) {
                if (uploader.files.length == 2) {
                    uploader.removeFile(uploader.files[0]);
                }
                plupload.each(files, function(file) {
                    jQuery("#filelist").css("display","block");
                    var img_type = file.name;
                    var type = img_type.split(".");
                    image_path = file.id+"."+type[1];
                    document.getElementById('filelist').innerHTML = '<div id="' + file.id + '" >' + img_type + ' (' + plupload.formatSize(file.size) + ') <b image_path="'+file.id+"."+type[1]+'" style="color:#fff;" onclick="removeImage(this);">x</b></div>';
                    jQuery("#upload_images").css("display","block");
                });
            },
     
            UploadProgress: function(up, file) {
                jQuery("#"+file.id).find("b").html('<span>' + file.percent + "%</span>");
            },
     
            Error: function(up, err) {
                document.getElementById('console').innerHTML += "'nError #" + err.code + ": " + err.message;
            }
        }
    });
    uploader.init();

等待回复。由于

我在ipad上有一个类似的问题。我复制了你的代码,它确实刷新了页面。

我尝试删除"PostInit"代码,但这阻止了页面刷新。