Path

Discussion in 'Javascript' started by Mateo, Mar 20, 2006.

  1. Mateo

    Mateo Guest

    Hi!

    I have JS program which opens XML file for parsing and loading informations
    from file on client side...
    I use file upload (file field) HTML control to browse for files.

    Problem:
    How can I write file path when I run program from the internet and need to
    force JS to load
    file from my local disk!?!?
    If I put path like this:
    file:///SomeFolder/SomeSubfolder/filename.xml
    it searches file on server.... or what?

    If I put my path like this
    C:/SomeFolder/SomeSubfolder/filename.xml
    doesn't work....

    Please help...
     
    Mateo, Mar 20, 2006
    #1
    1. Advertising

  2. Mateo wrote:

    > I have JS program which opens XML file for parsing and loading
    > informations from file on client side...
    > I use file upload (file field) HTML control to browse for files.
    >
    > Problem:
    > How can I write file path when I run program from the internet and need to
    > force JS to load
    > file from my local disk!?!?


    Please seek to improve your punctuation and posting style. This is Usenet.
    <URL:http://jibbering.com/faq/>

    You cannot access a resource from a resource accessed with a different
    protocol, second-level domain, or port part, unless you lower the security
    restrictions of the client or use a signed script. This is called the Same
    Origin Policy (introduced by Netscape, implemented by others), and we have
    discussed this very often before here.

    It also applies to local files (which have protocol "file", no domain, and
    no port number in their URI) from a resource retrieved via HTTP (protocol
    "http"); it does not matter that the script runs client-side.

    > If I put path like this:
    > file:///SomeFolder/SomeSubfolder/filename.xml
    > it searches file on server.... or what?


    No, it does not. The URI refers to the local file
    "/SomeFolder/SomeSubfolder/filename.xml" which is unlikely to exist,
    unless a unixoid filesystem is mounted to "/" (ext3, et al.)

    > If I put my path like this
    > C:/SomeFolder/SomeSubfolder/filename.xml
    > doesn't work....


    The correct URI would be "file:///C:/SomeFolder/SomeSubfolder/filename.xml",
    with the empty string before the third `/' being a shortcut for
    `localhost'.


    HTH

    PointedEars
     
    Thomas 'PointedEars' Lahn, Mar 20, 2006
    #2
    1. Advertising

  3. Mateo

    Mateo Guest

    Thx man!

    It looks much more clear to me:)
    This is kind of answer I was looking for.


    Mateo

    "Thomas 'PointedEars' Lahn" <> wrote in message
    news:...
    > Mateo wrote:
    >
    >> I have JS program which opens XML file for parsing and loading
    >> informations from file on client side...
    >> I use file upload (file field) HTML control to browse for files.
    >>
    >> Problem:
    >> How can I write file path when I run program from the internet and need
    >> to
    >> force JS to load
    >> file from my local disk!?!?

    >
    > Please seek to improve your punctuation and posting style. This is
    > Usenet.
    > <URL:http://jibbering.com/faq/>
    >
    > You cannot access a resource from a resource accessed with a different
    > protocol, second-level domain, or port part, unless you lower the security
    > restrictions of the client or use a signed script. This is called the
    > Same
    > Origin Policy (introduced by Netscape, implemented by others), and we have
    > discussed this very often before here.
    >
    > It also applies to local files (which have protocol "file", no domain, and
    > no port number in their URI) from a resource retrieved via HTTP (protocol
    > "http"); it does not matter that the script runs client-side.
    >
    >> If I put path like this:
    >> file:///SomeFolder/SomeSubfolder/filename.xml
    >> it searches file on server.... or what?

    >
    > No, it does not. The URI refers to the local file
    > "/SomeFolder/SomeSubfolder/filename.xml" which is unlikely to exist,
    > unless a unixoid filesystem is mounted to "/" (ext3, et al.)
    >
    >> If I put my path like this
    >> C:/SomeFolder/SomeSubfolder/filename.xml
    >> doesn't work....

    >
    > The correct URI would be
    > "file:///C:/SomeFolder/SomeSubfolder/filename.xml",
    > with the empty string before the third `/' being a shortcut for
    > `localhost'.
    >
    >
    > HTH
    >
    > PointedEars
     
    Mateo, Mar 21, 2006
    #3
    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. Keith-Earl
    Replies:
    1
    Views:
    2,024
    Peter O'Reilly
    May 3, 2004
  2. Replies:
    0
    Views:
    2,290
  3. Mupota Muchelemba
    Replies:
    1
    Views:
    949
    Tony Morris
    Feb 4, 2004
  4. Matt
    Replies:
    3
    Views:
    19,712
    Sudsy
    Jul 8, 2004
  5. James
    Replies:
    2
    Views:
    13,953
    Andrew Thompson
    Dec 7, 2004
Loading...

Share This Page