0
此問題已經解答了here和here。但是,使用版本1.5.6在FilesAdded(...)之前放置init()使其完全沒有響應。自動啓動上傳也不會以任何方式啓動。自動啓動選項plupload 1.5.6
var csvUploader = new function() {
var self = this;
self.init = function() {
var uploader = new plupload.Uploader(
{
runtimes: 'html4',
url: 'http://localhost:5073/Document/Upload',
browse_button: 'uploadCsvButton',
max_file_size: '100mb',
chunk_size: '1mb',
unique_names: true,
filters: [{ title: "CSV files", extensions: "csv" }]
});
/* postion 1: uploader.init(); /**/
uploader.bind('FilesAdded', function(up, files) {
setTimeout(function() { up.start(); }, 500);
});
uploader.bind('FileUploaded', function (up, file) {
// do some stuff here...
});
/*position 2: */ uploader.init(); /**/
}; // self.init
}; // NS:csvUploader
該模塊的initalization:
csvUploader.init();
所以,有經驗的同事這裏有什麼問題?模塊化模式還是別的?由於init()在位置2,所以調用方法FilesAdded的內容,但up.start();從不上傳文件到服務器。請有任何想法嗎?