// parent, args, callback wn.upload = { make: function(opts) { var id = wn.dom.set_unique_id(); $(opts.parent).append(repl('\
\
\ \
', { id: id, action: wn.request.url })); opts.args.cmd = 'uploadfile'; opts.args._id = id; // add request parameters for(key in opts.args) { if(opts.args[key]) { $('') .attr('name', key) .attr('value', opts.args[key]) .appendTo($(opts.parent).find('form')); } } $('#' + id).get(0).callback = opts.callback }, callback: function(id, file_id, args) { $('#' + id).get(0).callback(file_id, args); } }