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 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题
  • ¥15 Ubuntu20.04无法连接GitHub
  • ¥15 需要写计算过程,不要写代码,求解答,数据都在图上
  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥30 C++行情软件的tick数据如何高效的合成K线