gpt4 book ai didi

javascript - Plupload 在 ipad 上无法工作

转载 作者:行者123 更新时间:2023-11-28 06:48:44 25 4
gpt4 key购买 nike

我正在使用 Plupload 在我的网站上上传图像。它在所有桌面浏览器上都可以正常工作,但在 i-pad 上却不行。当我点击上传按钮时,它会刷新页面。我进行了搜索,但没有找到任何可以修复它的东西。最后,我来这里问我的问题。我正在使用 pl upload 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 上使用 plupload 时遇到了类似的问题。我复制了您的代码,它确实刷新了页面。

我尝试删除“PostInit”代码,这会停止刷新页面。

关于javascript - Plupload 在 ipad 上无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33167279/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com