Path

M

Mateo

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...
 
T

Thomas 'PointedEars' Lahn

Mateo said:
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
 
M

Mateo

Thx man!

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


Mateo
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top