Urinprobe
Urinprobe

Reputation: 97

saving an XMLDocument object created in javascript on the server using php

I changed an XMLDocument localy using javascript. How do I save it on the server? I tried the following:

if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
}
else{ // code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","./path/to/phpfile/file.php?newdocument="+newxmldocument,true);
xmlhttp.send();

In the php-file I wanted to do something like this:

$file = "./path/to/xmlfile/xmlfile.xml";
$dom = new DOMDocument();
$dom = $_REQUEST['newdocument'];
$dom->save($file);

This does not work, however.

Is there an easy way to save the XMLDocument object the php-file recieves?

Upvotes: 1

Views: 155

Answers (1)

Cucu
Cucu

Reputation: 305

You should try sending the XMLDocument with a POST as a multipart.

Upvotes: 1

Related Questions