My application creates .xml
files and stores them on the user\'s hard drive; there is a default folder that I set in the web.xml
to store the files, le
You cant access local filesystem using javascript. For accessing the file using javascript , you have to upload it to a server and access it using the files url.
It's best to expose your files via HTTP and use mxUtils.load("http://yoursite/static/yourfile.xml")
.
Search for static files
on Apache HTTP Server HowTo. Setup Apache to serve your xml files, make sure that you can view xml file in browser and then use the same url in mxUtils.load
call.
As stated, you cannot access a file on the filesystem strictly through Javascript. You could, however, use the input
file type to upload the file to your server and then read it:
<input type="file" name="myfileinput">
Then, you can access it via the $_FILES
global in PHP
- other languages also provide this functionality through other means. Please note, again, that there is absolutely no way to access a file that is on someone's filesystem with Javascript without their consent (i.e. using the file input type). That would be a huge security risk - imagine going to a page and having it wipe your whole D:/
drive.