I have some inherited code in HTML, which is not my best language. There is a part of the code where it is pulling data from an xml file from a specified directory with a .open command, the xml file contains a list html image tags with a list of filenames of image files in the same directory. It then displays the images to the webpage with a .write command. The problem is that since this was last touched, the files its looking for were moved so they are no longer on the virtual machine serving as a web server where it expects them. They are now local files on the main company file system. And you can access the files while ssh’d into the virtual machine, but instead of being under /var/www/html/restofpathname where it normally looks for files when you type http://servername/restofpathname, the files are now at /data/newpathname. Is it still possible to access the data in these files using get, .open, and .write? Are there other commands I need to use instead? Or do we just have to move the files back into the virtual machine, where space may or may not be an issue?
Here is a simplified version of the code:
var xmlfile = directorypath + "images.xml";
xmlhttp.open("GET",xmlfile,false);
xmlhttp.send();
xmldoc=xmlhttp.responseXML;
...
var x = xmldoc.getElementsByTagName( "image" );
for(i=0;i<x.length;i++)
{
var imagename = x[i].getElementsByTagName("name")[0].childNodes[0].nodeValue;
document.write( "<img src='" directorypath + imagename + "'/>");
}
It results in a 404 file not found because when you give it directorypath, which now is under /data/newpathname, it automatically adds http://servername in front of the address when it does xmlhttp.open(“GET”
I was hoping to be able to tell it to look in the local network file system instead of the virtual machine server. Is there a way to do that?