This is a migrated thread and some comments may be shown as answers.

Select dialog from JavaScript

3 Answers 90 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
james
Top achievements
Rank 2
james asked on 01 Jun 2008, 01:23 AM

Is it possible fire File Select dialog from javascript?

I woud like to call RadUpload's select button from javasript.

Regrads,

J


3 Answers, 1 is accepted

Sort by
0
james
Top achievements
Rank 2
answered on 01 Jun 2008, 10:23 AM
Hi,

I find one solution

I was add event on response started. Then I search file input. And rise click().

My code:

        function conditionalPostback(e, sender) 
        { 
            if (sender.EventTarget.indexOf("$btn_20_10") != -1) 
            { 
            
                var upload = $find("ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_RadUpload1");  
 
                var uploadBrowse = document.getElementById("ctl00_ctl00_ContentPlaceHolder_ContentPlaceHolder_RadUpload1file0");                
                uploadBrowse.click(); 
                
                                                        
                //AJAX is disabled only if file is selected for upload 
                if(upload.getFileInputs()[0].value != "") 
                { 
                    sender.EnableAjax = false
                } 
            } 
        } 

But in this solution is one problem. On submit I get error: "htmlfile: Access is denied.".

What is problem in my case?
is it possible to get browse window with RadUpload's  client side API.
0
james
Top achievements
Rank 2
answered on 01 Jun 2008, 10:26 AM
I think that is problem, because I didn't disable Ajaix on uploadBrowse How I can disable Ajaix for all elements?

Thanks inadvance,

J
0
Erjan Gavalji
Telerik team
answered on 02 Jun 2008, 10:40 AM
Hi james,

The reason for the "Access is denied" error is not related to disabling Ajax calls. Actually this is a limitation of the browser. When the click method of an HTML file input element is called, the attempt for a form submission either throws an "Access is denied" error, or gets canceled (and the file input field gets cleared).

To my regret calling the Browse dialog through javascript code is not possible in terms of server-side form submission.

Kind regards,
Erjan Gavalji
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Upload (Obsolete)
Asked by
james
Top achievements
Rank 2
Answers by
james
Top achievements
Rank 2
Erjan Gavalji
Telerik team
Share this question
or