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.

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

报告相同问题?

悬赏问题

  • ¥20 keepalive配置业务服务双机单活的方法。业务服务一定是要双机单活的方式
  • ¥50 关于多次提交POST数据后,无法获取到POST数据参数的问题
  • ¥15 win10,这种情况怎么办
  • ¥15 如何在配置使用Prettier的VSCode中通过Better Align插件来对齐等式?(相关搜索:格式化)
  • ¥100 在连接内网VPN时,如何同时保持互联网连接
  • ¥15 MATLAB中使用parfor,矩阵Removal的有效索引在parfor循环中受限制
  • ¥20 Win 10 LTSC 1809版本如何无损提升到20H1版本
  • ¥50 win10 LTSC 虚拟键盘不弹出
  • ¥30 微信小程序请求失败,网页能正常带锁访问
  • ¥15 Matlab求解微分方程,如何用fish2d进行预优?