Permisos para escribir en XML desde jquery arrastrable

From the stop event of a draggable div, I call a php function through ajax. There are permission errors when that script saves the XML.

Warning: SimpleXMLElement::asXML(communities.xml) simpleelement.asxml failed to open stream: permission denied in c:\path\make_update.php. 

The ajax call is done in a div created dynamically, i.e. the div is created by a script and the call to save the xml is defined like this.

echo "  $('#".$node['ID']."').draggable({ stop: function(event, ui) { update_div('".$node['ID']."') } });\n";

The ajax call is done like this.

    function update_div(divid) {

        width= $('#'+divid).width();
        coord =$('#'+divid).position();
        dtop =;
        dleft = coord.left;
        name = "";

        /* alert ('Finished dragging! '+divid+' '+width+' '+height+' '+dtop+' '+dleft); */

       //define php info and make ajax call to update XML
           url: "make_update.php",
           type: "POST",
           data: { nodeid: divid, name: name, top: dtop, left: dleft, width: width, height: height },
           cache: false,
           success: function (response) {

               if (response != '') 



ini_set('display_errors', 1);

function make_update( $nodeid, $name, $top, $left, $width, $height ) {

$nodes = new SimpleXMLElement('communities.xml', null, true);

$returnArray = $nodes->xpath("//COMMUNITY[@ID='$nodeid']");  
$node = $returnArray[0]; 
$node->TOP = $top;


return $node->TOP;

echo make_update(trim($_REQUEST['nodeid']),trim($_REQUEST['name']),trim($_REQUEST['top']),trim($_REQUEST['left']),trim($_REQUEST['width']),trim($_REQUEST['height']));


The data is being retrieved from the XML file. The problem is the permission to save the file. Elsewhere I am able to save the XML. The difference here is that the script is called from .draggable(). How do I define the permissions to be able to save the XML in that scenario? The permission on the XML and the directory where it is located are read write.

preguntado el 27 de agosto de 11 a las 17:08

1 Respuestas

It has to do with the folder/file permissions defined on the server. Open the properties for the folder that the XML file resides in Windows and make sure your server can read/write to that folder.

Respondido 27 ago 11, 21:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.