Adding a client image to a page

Discussion in 'Javascript' started by dcaveney@the-wire.com, Jan 1, 2007.

  1. Guest

    Is there any way to replace the "src" attribute of an <img> element
    with the name of a file on the client (obtained by a <input
    type="file"...> element, for example) in such a way that the page then
    displays the client's image. Without uploading the specified file to
    the server, is there any way to render the client's image in a page
    that originates from a remote server. An attempt that DOESN'T work is:

    <body
    onload="javascript:document.getElementById('myImage').src='file://c:\\yourImage.jpg';">
    <img id="myImage" />
    </body>

    ....but hopefully illustrates what I'm trying to do.
     
    , Jan 1, 2007
    #1
    1. Advertising

  2. Randy Webb Guest

    said the following on 1/1/2007 12:45 PM:
    > Is there any way to replace the "src" attribute of an <img> element
    > with the name of a file on the client (obtained by a <input
    > type="file"...> element, for example) in such a way that the page then
    > displays the client's image. Without uploading the specified file to
    > the server, is there any way to render the client's image in a page
    > that originates from a remote server. An attempt that DOESN'T work is:
    >
    > <body
    > onload="javascript:document.getElementById('myImage').src='file://c:\\yourImage.jpg';">
    > <img id="myImage" />
    > </body>
    >
    > ...but hopefully illustrates what I'm trying to do.


    No.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
     
    Randy Webb, Jan 1, 2007
    #2
    1. Advertising

  3. Evertjan. Guest

    Randy Webb wrote on 01 jan 2007 in comp.lang.javascript:

    > said the following on 1/1/2007 12:45 PM:
    >> Is there any way to replace the "src" attribute of an <img> element
    >> with the name of a file on the client (obtained by a <input
    >> type="file"...> element, for example) in such a way that the page
    >> then displays the client's image. Without uploading the specified
    >> file to the server, is there any way to render the client's image in
    >> a page that originates from a remote server. An attempt that DOESN'T
    >> work is:
    >>
    >> <body
    >> onload="javascript:document.getElementById('myImage').src='file://c:\\
    >> yourImage.jpg';"> <img id="myImage" />
    >> </body>
    >>
    >> ...but hopefully illustrates what I'm trying to do.

    >
    > No.
    >


    Yes, that he is trying to do what is not possible without compromizing the
    web security settings of the browser.

    Further, that he has not read the FAQ entry about "javascript:

    Further, that he does not know that onload="" reads javascript by default.

    A fine illustation IMHO.

    And that the client can see his/her own image in any mirror,
    not needing javascript activated at all.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Jan 1, 2007
    #3
  4. Si Ballenger Guest

    On 01 Jan 2007 18:39:21 GMT, "Evertjan."
    <> wrote:

    >Randy Webb wrote on 01 jan 2007 in comp.lang.javascript:
    >
    >> said the following on 1/1/2007 12:45 PM:
    >>> Is there any way to replace the "src" attribute of an <img> element
    >>> with the name of a file on the client (obtained by a <input
    >>> type="file"...> element, for example) in such a way that the page
    >>> then displays the client's image. Without uploading the specified
    >>> file to the server, is there any way to render the client's image in
    >>> a page that originates from a remote server. An attempt that DOESN'T
    >>> work is:
    >>>
    >>> <body
    >>> onload="javascript:document.getElementById('myImage').src='file://c:\\
    >>> yourImage.jpg';"> <img id="myImage" />
    >>> </body>
    >>>
    >>> ...but hopefully illustrates what I'm trying to do.

    >>
    >> No.
    >>

    >
    >Yes, that he is trying to do what is not possible without compromizing the
    >web security settings of the browser.
    >
    >Further, that he has not read the FAQ entry about "javascript:
    >
    >Further, that he does not know that onload="" reads javascript by default.
    >
    >A fine illustation IMHO.
    >
    >And that the client can see his/her own image in any mirror,
    >not needing javascript activated at all.
    >
    >--
    >Evertjan.
    >The Netherlands.
    >(Please change the x'es to dots in my emailaddress)


    Did somebody wake up on the wrong side of the canal this
    morning??? ;)
     
    Si Ballenger, Jan 1, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard
    Replies:
    6
    Views:
    1,134
    Yan-Hong Huang[MSFT]
    Jun 22, 2004
  2. Laszlo Zsolt Nagy
    Replies:
    1
    Views:
    1,436
    Kartic
    Jan 26, 2005
  3. Andrea Williams

    Adding client-script to handle client events

    Andrea Williams, Apr 12, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    146
    Andrea Williams
    Apr 12, 2004
  4. Zoe Hart
    Replies:
    1
    Views:
    405
    Scott Wisniewski
    Jan 8, 2004
  5. mscir
    Replies:
    4
    Views:
    134
    mscir
    Sep 11, 2005
Loading...

Share This Page