RE: Using file:// for an image source

"Seb Frost" <[email protected]> Tue, 6 Jun 2006 11:39:33 +0100
Newsgroups gmane.comp.web.dom.wdf
Message-ID <[email protected]>
It would be quite a nice touch as a "preview what you're about to upload",
but as mentioned this behaviour is disallowed on most browsers due to
security implications - you could find out a lot about a person's system if
you could link to their local files from a remote web page.

In this case there's clearly no security issue (if the user is happy to
upload the file to the site they shouldn't have any qualms displaying it on
the page, if it's just an image) - but you can't expect browsers to make odd
exceptions to the rule for this sort of thing.

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf
Of Anthony Ettinger
Sent: 05 June 2006 20:34
To: [email protected]
Subject: Re: [wdf-dom] Using file:// for an image source


I didn't test it remotely. I just checked and it doesn't work in FF or
Opera.

Having said that I'm not surprised IE loads it, as it's probably
disabled in FF and Opera for security reasons.

What's the purpose of this anyway, only the visitor would see their
image, if they're uploading it you're better off caching it on the web
server and referring to it with a relative path:

src="/cache/<sid>-image-name.jpeg"



On 6/5/06, Ian Petersen <[email protected]> wrote:
> I tested an IMG tag in Firefox that had a file:// source.  It worked
> when I loaded the HTML file from a file:// URL but not from an http://
> URL.  How did you get it to work, Anthony?
>
> Ian
>
> On 6/5/06, Anthony Ettinger <[email protected]> wrote:
> > This seems to work for me in IE, FF, Opera:
> >
> > <img src="file://C:\Documents and Settings\aettinger\My Documents\My
> > Pictures\farley_2006\farley-pup.jpg" alt="" width="300" height="225"
> > border="0">
> >
> >
> >
> >
> > On 6/4/06, Steffan A. Cline <[email protected]> wrote:
> > > I am trying to do something seemingly difficult. I am trying to take
the
> > > value from a file input and set the source of an image to the value of
the
> > > file input. It seems to only work on Safari. In FF I can do it and
then when
> > > viewing the rendered chart I see the image is there with the correct
path
> > > and all. For example file:///Users/me/desktop/1234.jpg Is this a
security
> > > thing? I can have multiple images from multiple domains on a page but
not
> > > one from the users hd. Confusing? Here is a sample of the code:
> > >
> > > <img src="" id="preview">
> > >
> > > <input type="file" name="test"
> > > onchange="document.getElementById('preview').src =
('file://'+this.value);">
> > >
> > >
> > > Again, this works in Safari perfectly. In FF I can view the source
chart and
> > > it has the correct path. Just not displaying. I even tried using the
DOM to
> > > create a new image and plant it on the page. The image is there but
not
> > > displayed. Is there a work around for this?
> > >
> > >
> > >
> > >
> > > Thanks
> > >
> > > Steffan
> > >
> > > ---------------------------------------------------------------
> > > T E L  6 0 2 . 5 7 9 . 4 2 3 0 | F A X  6 0 2 . 9 7 1 . 1 6 9 4
> > > Steffan A. Cline
> > > [email protected]                             Phoenix, Az
> > > http://www.ExecuChoice.net                                  USA
> > > AIM : SteffanC          ICQ : 57234309
> > > The Executive's Choice in Lasso driven Internet Applications
> > >                                   Lasso Partner Alliance Member
> > > ---------------------------------------------------------------
> > >
> > >
> > >
> > >
> > >
> > >
> > > Unsubscribe
> > > [email protected]
> > >
> > > List info
> > > http://www.quirksmode.org/dom/list.html
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > --
> > Anthony Ettinger
> > Signature: http://chovy.dyndns.org/hcard.html
> >
> >
> >
> > Unsubscribe
> > [email protected]
> >
> > List info
> > http://www.quirksmode.org/dom/list.html
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> Tired of pop-ups, security holes, and spyware?
> Try Firefox: http://www.getfirefox.com
>
>
>
> Unsubscribe
> [email protected]
>
> List info
> http://www.quirksmode.org/dom/list.html
> Yahoo! Groups Links
>
>
>
>
>
>
>


--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html



Unsubscribe
[email protected]

List info
http://www.quirksmode.org/dom/list.html
Yahoo! Groups Links








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Everything you need is one click away.  Make Yahoo! your home page now.
http://us.click.yahoo.com/AHchtC/4FxNAA/yQLSAA/9rHolB/TM
--------------------------------------------------------------------~-> 

Unsubscribe
[email protected]

List info
http://www.quirksmode.org/dom/list.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wdf-dom/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/