1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| var uploader = new plupload.Uploader({ browse_button : 'rs-uploader', url : '/manage/upload', chunk_size : '1mb', multi_selection : false, filters : { max_file_size : '10mb', mime_types: [ {title : "Image files", extensions : "jpg,gif,png"}, {title : "Zip files", extensions : "zip"} ] }, flash_swf_url : '../js/Moxie.swf', silverlight_xap_url : '../js/Moxie.xap', preinit : { Init: function(up, info) { }, UploadFile: function(up, file) { } }, init : { BeforeUpload: function(up, file) { console.log('[BeforeUpload]', 'File: ', file);
uploader.setOption("multipart_params", { "post_id" : 1, "post_author" : 2 });
uploader.settings.multipart_params.test_id = 2; uploader.settings.multipart_params.test_author = "Wang"; }, FilesAdded: function(up, files) { console.log('[FilesAdded]'); plupload.each(files, function(file) { console.log(' File:', file); });
uploader.start(); } } });
uploader.init(); });
|