How to preview image before upload

Thread is closed for posting
2 posts, 0 answers
  1. Henry John
    Henry John avatar
    8 posts
    Member since:
    Apr 2010

    Posted 11 May 2010 Link to this post

    I have tried to preview image before upload but i cannot. i also use code in document but still not.
    This Code:

    <

     

    script type="text/javascript">

     

     

    function OnClientFileSelectedHandler(sender, eventArgs)

     

    {

     

    debugger;

     

     

    var input = eventArgs.get_fileInputField();

     

     

    //check the extension

     

     

    if (sender.isExtensionValid(input.value))

     

    {

     

    var img = document.getElementById('<%= imgAttach.ClientID %>');

     

     

    if (img)

     

    {

    img.style.visibility =

    "";

     

    img.src = eventArgs.get_fileInputField().value;

    }

    }

    }

     

    </script>
    Please hepl me and if can send me a example about this.Thanks

     

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 May 2010 Link to this post

    Hi,

    The limitation of above code is, it will work correctly on IE browser only, since in Firefox the input.value returns the filename instead of the full path to the file. For security reasons the code will work only on localhost, to make it work remotely you need to add the site to the Trusted Sites.

    Please check the Limitations part of this help article.

    .

    .

    Also go through the following forum link which discusses a similar scenario.

    Preview in Rad Upload

    -Shinu.

  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top