I am using the latest version of Plupload (2.1) - user interface widget
when i click upload files, it uploads all files correctly.
but when I try to upload files using the form submit button. he does not work. it just shows a small file upload and then submits the forms without completing the file upload.
here is my code:
jj = jQuery.noConflict();
jj(function() {
jj("#flash_uploader_other").plupload({
runtimes : 'html5,flash,silverlight,html4',
url : '/external/uploader-new/upload.php',
max_file_size : '10mb',
chunk_size : '1mb',
unique_names : true,
filters : [
{title : "jpg,xls,csv,doc,pdf,docx,xlsx", extensions : "jpg,xls,csv,doc,pdf,docx,xlsx"}
],
flash_swf_url : '/external/uploader-new/js/Moxie.swf',
silverlight_xap_url : '/external/uploader-new/js/Moxie.xap'
});
jj('form').submit(function(e) {
if (jj('#flash_uploader_other').plupload('getFiles').length > 0) {
jj('#flash_uploader_other').on('complete', function() {
jj('form').submit();
});
jj('#flash_uploader_other').plupload('start');
}
});
Please, help!
thank
now works I replaced the following code
jj('form').submit(function(e) {
if (jj('#flash_uploader_other').plupload('getFiles').length > 0) {
jj('#flash_uploader_other').on('complete', function() {
jj('form').submit();
});
jj('#flash_uploader_other').plupload('start');
}
});
With this code:
jj('form').submit(function(e) {
var uploader = jj('#flash_uploader_other').plupload('getUploader');
if (uploader.total.uploaded == 0)
{
if (uploader.files.length > 0)
{
uploader.bind('UploadProgress', function ()
{
jj('#flash_uploader_other').on('complete', function() {
jj('form').submit();
});
});
jj('#flash_uploader_other').plupload('start');
} else { jj('form').submit();}
e.preventDefault();
}
});