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.