dongli5785 2013-11-27 19:33
浏览 111
已采纳

Plupload问题 - 文件正在上传{Filename} .part&FileUploadedevent未被触发

I am using Plupload with php, My code is as follows.

My Issues

Issue 1 :: files are being uploaded but .part is being added at end of file name. Progress bar shows 100%.

Issue 2 :: FileUploaded event is not triggering.

<script type="text/javascript">
// Custom example logic

var uploader = new plupload.Uploader({
    runtimes : 'html5,flash',
    browse_button : 'pickfiles', // you can pass in id...
    container: document.getElementById('container'), // ... or DOM Element itself
    url : 'upload.php',
    flash_swf_url : 'js/upscript/Moxie.swf',
    silverlight_xap_url : 'js/upscript/Moxie.xap',
    multiple_queues : false,
    multi_selection : false,
    multipart_params : {folder:'lbs'},
    filters : {
        max_file_size : '10mb',
        mime_types: [
            {title : "Video files", extensions : "<?php echo implode(",",$allowed_files)?>"}
        ]
    },

    init: {
        PostInit: function() {
            document.getElementById('filelist').innerHTML = '';

            document.getElementById('uploadfiles').onclick = function() {
                uploader.start();
                return false;
            };
        },

        FilesAdded: function(up, files) {
            plupload.each(files, function(file) {
                document.getElementById('filelist').innerHTML += '<div id="' + file.id + '">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></div>';
            });
        },

        UploadProgress: function(up, file) {
            document.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
        },

        Error: function(up, err) {
            document.getElementById('console').innerHTML = "
Error #" + err.code + ": " + err.message;
        },
        FileUploaded: function(up, file, info) {
            console.log(info);
            var response = jQuery.parseJSON(info.response);
            if(response.st == "ok")
            {
                window.location.href = window.location.href.replace('?saved','') + '?saved';
            }
            //document.getElementById('console').innerHTML = "
Error #" + response.error.code + ": " + response.error.message;
        }
    }
});

uploader.init();

</script>

Kindly Advise.

  • 写回答

1条回答 默认 最新

  • douyingyu5573 2014-01-09 20:30
    关注

    I found the solution for my issue.

    I was uploading a file with size more than it was set for allowed size in the PHP configuration.

    I have increased value for upload_max_filesize and post_max_size and it is fixed.

    This may help to others with same issue.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料