Plupload issue - File is being uploaded with {Filename}.part & FileUploadedevent is not being triggered

StackOverflow https://stackoverflow.com/questions/20251469

سؤال

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 = "\nError #" + 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 = "\nError #" + response.error.code + ": " + response.error.message;
        }
    }
});

uploader.init();

</script>

Kindly Advise.

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top