blueimp/jQuery-File-Upload — Issue #1010: Multiple instances of FileUpload across my application
Author: medj
Created: 2012-02-13 17:06:55+00:00
State: open

I currently have 5+ places in my application where file uploads can happen. I would like to avoid duplicating code in the different places. I have made a jquery plugin called FileUploadWrapper which I can use in the different spots, but I can't get it to work. Let me show you some parts of my code:

HTML:

I don't want to put any of the template code or form code above. I use the wrapper plugin to generate all that HTML for me. Here are some parts of the wrapper plugin.

base.init = function(){
$('head').append('');
base.options = $.extend({}, $.Uploader.defaultOptions, options);
base.$el.html(base.generatehtml());
base.uploader = base.$el.find('form').fileupload(base.options);
};

base.generatehtml = function(){
// this function generates all the form code HTML and row template code
// it also includes the fileupload plugin at the very end of the code as seen below

// The Templates plugin is included to render the upload/download listings -->
output += '';
// The Iframe Transport is required for browsers without support for XHR file uploads -->
output += '';
// The basic File Upload plugin -->
output += '';
// The File Upload user interface plugin -->
output += '';

};

It doesn't seem to work. Can anyone point me in the right direction here? I really just want to be able to have uploaders in different parts of my site without duplicating all the code needed to display an uploader. Thanks