From: Mateo on
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...


From: Thomas 'PointedEars' Lahn on
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
From: Mateo on
Thx man!

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


Mateo

"Thomas 'PointedEars' Lahn" <PointedEars(a)web.de> wrote in message
news:1810105.G1FiRVBk1k(a)PointedEars.de...
> 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