1 (edited by StepanMatl 2012-03-27 15:53:20)

Topic: Check if Plupload was initialized

Hi, I spent whole afternoon by thinking about problem, how can I check, if Plupload was initialized successfully?
I need to show simple file uploader, when Plupload is not initialized (becase of missing runtimes, etc).
I want to use only flash runtime and there is a problem - flash can't be initialized in hidden element, so I can't make the browse button unvisible first and show it right after successful initialization of Plupload.
I've tried to find the answer in the API Documentation, but I haven't found it.
Please, can someone give me an advise?
Thanks.

Re: Check if Plupload was initialized

your post is a little confusing, So I will answer you first question:

Use postinit event:

preinit: {
                PostInit: function(up) {
                    //your code here
                }
            }

Is this what you wanted?

3 (edited by StepanMatl 2012-03-28 12:21:57)

Re: Check if Plupload was initialized

Thanks, but this code is only for jQuery queue widget, isn't?
I'm looking for solution for "plupload.Uploader"...

I am suprised that Plupload doesn't support this basic feature. Or I am blind and I haven't discovered it yet big_smile.
People can view my website on tablets, mobile devices, or just in browsers with no flash installed, so thus I need a basic function, which will be waiting for successful initialization of Plupload and if some error occurs (missing flash, etc), then div with HTML file inputs will be changed to "display: block".

Re: Check if Plupload was initialized

Simply, I need solution for this two situations:

1) Flash is installed and plupload initialized succesfully - show Plupload add button and hide div with <input type="file"> elements.
2) Flash is not installed or something goes wrong - hide Plupload and show div with <input type="file"> elements. Silently, without any messages or errors.

Re: Check if Plupload was initialized

2) Flash is not installed or something goes wrong - hide Plupload and show div with <input type="file"> elements. Silently, without any messages or errors.

why do you wanna use simple <input type="file"> since plupload supports HTML4?

Re: Check if Plupload was initialized

Wait... you say that I can use multiple upload (multiple file select) without Flash, online with HTML4 runtime?

Re: Check if Plupload was initialized

yes, take a look on this page:

http://www.plupload.com/example_all_runtimes.php

8 (edited by StepanMatl 2012-03-28 17:01:22)

Re: Check if Plupload was initialized

But this is for plupload.Queue, I use custom uploader, plupload.Uploader...
HTML4 supports multiple file upload, but not multiple file select in the browse window.
Go on the link below, click on "Nahrat fotky z PC" (it's in czech), then turn off Flash and reload the page. I must put there a message, which says that something failed and user must click on the link to show the pure HTML upload input.
I need to do this automatically and thus I need to check, if Plupload and its runtime was initialized succesfully and correctly.

http://www.xinzerce.com/podat-inzerat-zdarma/

Re: Check if Plupload was initialized

as I said, It's HTML4, so in the "File Select" dialog you can only select 1 file at once.

What I can't understand is why is that a problem to click four times in the plupload "add files" button. You will need to do the same thing with the <input type="file"> fields

Re: Check if Plupload was initialized

Yes, but the <input type="file"> fields show only if Plupload can't be started.
Users don't want have to click four times on the browse button, they want select multiple (max. 4) files in one step. It's very important feature.
Doesn't matter, we still don't understand each other big_smile.
I will keep trying finding a solution myself.
But thanks for help!

Re: Check if Plupload was initialized

lol,

do you agree with me that if the user has 4 input type file fields, he will have to select a file for each input type file.

so, doesn't matter if a user has to click four times in the same button or one time in four different buttons.

Do you know that you can specify multiple runtimes for plupload?

what I'm saying is

if you initialize plupload with this option:

runtimes : 'flash,html4'

you don't need to worry about testing if the flash is installed or not. the plupload will test if the flash version is installed and will choose the right runtime for the user.

But if you still want the "input type file", I'm sorry but I can't help you.

Re: Check if Plupload was initialized

OMG, I'm idiot...
Yeah, now I understand how you think it... This is much better solution.
Lol... big_smile Thanks a lot! big_smile