17

I'm trying to use the jQuery-File-Upload plugin. But I have a problem when actually trying to invoke the function. Somewhere in my code, I'll call $(fubar).fileupload, and get Uncaught TypeError: Object #<Object> has no method '_on' jquery.fileupload.js:977. Now this is happening after the page and all js scripts have been loaded.

A) A similar error is discussed in the tool's boards. I tried the technique of including jquery.fileupload.js just after the dom loads. I tried the technique, with something like below.

  <script src='/static/presentation/js/lib/jquery.fileupload.js'></script>
  <script src='/static/presentation/js/lib/jquery.iframe-transport.js'></script>
</body>

But when loading the page, I get another error Uncaught Error: Mismatched anonymous define() module: function ($) {... .

B) On documentReady, I even tried dynamically generating and including the script tags, in head. But I get the same error Uncaught Error: Mismatched anonymous define() module: function ($) {... .

I'm using jquery-file-upload with requirejs. I only bring that up I tested out the library and got it working with a plain jane static site. Just the basic js library files. So I don't know what's causing this. But it doesn't seem to be DOM related.

Any help is appreciated.


Assuming you're expecting only plain text (for a good record), and if you can make the assumption that you will only receive normal characters (i.e. keyboard-characters), you can take your input, convert to ASCII, then limit it to the characters that you want (by providing a list of allowable characters and filtering from that), and also ensure the string length is appropriate.

Then build a new string with only your acceptable characters, and pass that string in. Once you're there, the single-quote is definitely your only concern.

If you can make those requirements, then this should work for you. There'd be no way to inject funky Unicode characters, or overflow the SQL buffer, or do any of that other crazy stuff that people do to cause problems - you'd be in 100% control of the characters that go into the query.

4

3 回答 3

25

好的,我刚刚想通了。我只需要包含jquery.fileupload.jsafterjquery.ui.widget.jsjquery.iframe-transport.js. 至少我知道以供将来参考。

<script src='/static/presentation/js/lib/jquery.ui.widget.js'></script>
<script src='/static/presentation/js/lib/jquery.iframe-transport.js'></script>
<script src='/static/presentation/js/lib/jquery.fileupload.js'></script>
于 2012-11-02T00:14:15.367 回答
0

确保您运行的是 jQuery 和 jQuery UI 的互补版本,并且只有一个 jQuery 副本。我意识到我有运行在 1.10 的 jquery-rails 和一个本地 jQuery 1.11 文件,删除后者并升级前者就可以了。

于 2015-01-27T21:08:59.787 回答
-1

使用最新版本的蓝色小鬼,我只需将 jquery.ui.widget.js 更改为 jquery-ui-1.9.2.custom.min.js 并且效果很好。希望这有助于有人坚持这一点。

于 2013-11-11T10:28:50.890 回答