Plupload for Web 2.0

I have been using this uploader wrapped by @Philip Zedalis for some time.

https://forum.xojo.com/t/open-source-upload-control-for-xojo-web/38497/13

I’ve tried to get it running on xojo web 2.0 but it seems to get stuck at executing the initial setup command for the plupload javascript library.

Code sent to the browser with executeJavascript is getting stuck on the line that looks something like this:

$(#).plupload({

From debug xojo’s js try catch method reveals that #).plupload is not recognised as a method.

This odd looking line of jquery is passing the ID to the method, but perhaps the new EcmaScript 6 doesnt support this?

I’ve confirmed the libraries are loaded correctly and the name spaces are okay.

At a bit of a loss here, help appreciated!

I’m going to try wrapping the code to specify it’s jQuery.
jQuery(function($) {
});

1 Like

image
Nope… Haven’t been able to crack it yet. Perhaps there is a jQuery conflict of some sort…

Edit: Xojo is using jQuery v3.4.1 and Plupload is using jQuery v1.9.0.

this looks like the pupload libraries are accessing jQuery functions but jQuery isn’t loaded yet.

try to load the pupload libraries secondly after the app is loaded.

Edit to your edit:
1.9.0 should be compatible with most 3.x functions. otherwise you should load the old library also before you load pupload libraries.

jQuery should be smart enough to handle several jQuery libraries.

Hmmm thanks @Lars_Lehmann, the code is being triggered by a push button on the page, so not sure that is the issue. Perhaps the Plupload JS library has some init stuff that is happening out of sequence. It’s odd that it works fine on web 1.0 but not 2.0.

Should be smart enough… I’ll double check both libraries are actually being loaded.

Web 1.0 hasn’t used jQuery, so it were completely up to you to load the library files into your app.
Web 2.0 uses it vastly, so building your app with legacy controls can/will make some pain as you now
notice.


Both libraries are loaded… going to do some digging to see if there is a way to tell a function to use a specific version of jQuery.

Thanks for your input @Lars_Lehmann Kinda did it… Issue arising in other parts of the code though, all relating to missing methods. Doesn’t seem like Plupload plays nice when another version of jquery is around. Might have to try sandbox it in an Iframe or something weird…

<script>
    jq19 = jQuery.noConflict(true);
</script>

$(#).plupload({

Any ideas anyone?

maybe you should update to the current version which supports newer jQuery versions.
https://www.plupload.com/

1 Like

No there’s a sane idea. Let me try that. All going well I’ll send a pull request to @Phillip_Zedalis repo.

1 Like

Tried that. Interestingly, Plupload works on web 1.0 with jQuery 3.x, but not on web 2.0. I think it might go back to web 2.0 implementation of executeJavascript.

There are also other considerations. As an example, Web 2.0 includes jQuery UI, but not all of it.

2 Likes

Couldn’t get web 2.0 and Plupload Libs to play nice together. Ended up just running Plupload in an iframe, then embedding that into Xojo web 2.0

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.