I have an app that loads conversations. Each time a conversation is loaded I need to destroy and re init the file uploader.
Per: https://github.com/blueimp/jQuery-File-Upload/wiki/API
I’m trying:
// First destroy existing instance
$('.upload').fileUpload('destroy');
// Init
$('.upload').fileUploadUI({
........
Problem is on first run I get an error: “Uncaught No FileUpload with namespace “file_upload” assigned to this element”
Any ideas on how I can somehow detect if the plugin has been applied and only then destroy? Thansk
You should be able to detect if the plugin has been applied to an element using the “namespace” (as the plugin refers to it), which is the
.data()key the plugin uses.With the current
defaultNamespacebeing'file_upload', try:Instead of just:
This will mirror the plugin’s own test, which you can see around line 920 of the current source.