Register File Selection to a Image

Thread is closed for posting
4 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    33 posts
    Member since:
    Jan 2011

    Posted 20 Jan 2011 Link to this post


    I am attempting to register the RadUpload control to an image button event.

    Currently, I have the image button in place and I have created a separate page with the RadUpload control registered and I will be using an iframe to render in the background without being shown to the user.

    I want the image button to open the actual file selection (browse button) from the image press, allow the user to select a file and pass this back to the originating page.

    Is there a JavaScript method I can access that will allow me to do this?

    Currently I have (Ignore the implicit drill down to the control, I am going to create a loop to find the "ruButton ruBrowse" class) :

    But the image button does nothing when clicked...

  2. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 20 Jan 2011 Link to this post

    Hello Jonathan,

    I tried this and it works:

    // get RadUpload control
    var fileUpload = $find("<%=RadUpload1.ClientID %>");
    // ger file inputs
    var inputs = fileUpload.getFileInputs();
    // click first file input

    I hope that helps.
  3. DevCraft R3 2016 release webinar banner
  4. Jonathan
    Jonathan avatar
    33 posts
    Member since:
    Jan 2011

    Posted 20 Jan 2011 Link to this post


    I am getting an Access is Denied error when trying to submit the form to the server:

    function Update()
         window.parent.Update(document.getElementById('upload2').value, _labelId);
         //Access is Denied error occurs on the below line

  5. Dimitar Terziev
    Dimitar Terziev avatar
    1266 posts

    Posted 21 Jan 2011 Link to this post

    Hello Jonathan,

    In general what you are trying to achieve is not allowed except in some versions of IE. Probably what's Cori could achieve it , but this is not supported in other browsers like Mozilla and etc. Also this is not very safe from security side to be able to open the browse for file window through javascript.
    There is no workaround for this scenario, that we could provide.

    Dimitar Terziev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top