CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2007
    Location
    India
    Posts
    30

    Lightbulb display image in a <img> control placed in iframe

    hi all,

    I'm trying to display an image in a <img> control which is placed inside an iframe. for this I'm using <asp:FileUpload> control..

    how can I do it using javascript?? I have tried all the codes that has been given in almost all websites.. I hav really run out of resources..

    guys, u can only help me ...

    pls.. help me out .....


    thanx in advance :-)

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: display image in a <img> control placed in iframe

    What exactly are you trying to do? You aren't being really clear.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Oct 2007
    Location
    India
    Posts
    30

    Lightbulb Re: display image in a <img> control placed in iframe

    Hi PeejAvery,

    As I hav mentioned in my previous post, that I'm using a file upload control which is placed in an iframe. After I click the browse button and select an image, I would like to display that image in an <image> control which too is placed within the iframe.

    The file upload control <tag> looks like this..

    <input type="file" id="fileUserAttachment" runat="server" onchange="return StartFileChangeTimer();" />

    And inside StartFileChangeTimer() function , I'm trying to display the image in the <image >control.. However, the code to display image is executing without any problem.. but the image is not being displayed..


    The following code is what I have used to display the image..

    var sFileName = document.getElementById('fileuploadControl').value;
    sFileName = sFileName.replace(/\\/g,'/');

    document.getElementById('imgControlID').style.display = 'block';
    document.getElementById('imgControlID').src = sFileName ;

    From this , can u tell me where I have gone wrong ???

    any help would b much appreciated .. :-)

    thanx PeejAvery

  4. #4
    Join Date
    May 2002
    Posts
    10,943

    Re: display image in a <img> control placed in iframe

    Are you using Internet Explorer? If so, that would explain its lack of functionality.

    Microsoft removed the ability to show images if the src attribute points to the local machine (ie. c:\path\to\image.jpg).
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  5. #5
    Join Date
    Oct 2008
    Posts
    3

    Re: display image in a <img> control placed in iframe

    its not possible to display an image using js.
    u could better save the image to server and then relaod it.. a postback wil do that for u..

    i think that may work.. just try it..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured