Msgstr "Error calling method in NPObject!" in uploadify

I use Uploadify to upload a file to my CMS. Until recently, everything was working fine. I got an error

Error calling method on NPObject

in this line

document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, checkComplete);

in this part

 uploadifyUpload:function(ID,checkComplete) { jQuery(this).each(function() { if (!checkComplete) checkComplete = false; document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, checkComplete); }); }, 

I donโ€™t know why, even after a day of debugging and testing, I found that if I remove replace(/\&/g, '\\&') from

 String.prototype.escAll = function(){ var s = this; return s.replace(/\./g, '\\.').replace(/\?/g, '\\?').replace(/\&/g, '\\&'); }; 

Then it works again. I really don't know why.

Any help would be appreciated!

+7
source share
1 answer

I think the reason is the additional Javascript libraries you use.

Some libraries (e.g. Prototype.js or jQuery.js) modify the behavior of your code. For example, you cannot overload prototype in some cases. The result can be undefined in clear (obvious) places (for example, you are using an array variable with the wrong index). You should look at the source code of additional libraries, maybe they are doing something with prototype that violates your code in the function you specify.

In my practice, I had a situation where prototype overloading did not work correctly (it was a String prototype, as in your case).

So just do not use prototype .

0
source

All Articles