Delete Child Node Row From XML File

Allellirm

New Member
I wonder whether someone may be able to help me please.I've put together this page which allow users to view their uploaded images in a gallery. When an image is initially uploaded, the physical image is saved to the following filepath \[code\]UploadedFiles/userid/locationid/image\[/code\] and the image details i.e. description etc, are saved in a xml file called \[code\]files.xml\[/code\]. This is also stored in the same folder as the image. An extract of the XML file is shown below.\[code\]<files> <file name="A-deer-in-Knole-Park-Seve-005.jpg" source="A-deer-in-Knole-Park-Seve-005.jpg" size="89509" originalname="A-deer-in-Knole-Park-Seve-005.jpg" description="No description provided" userid="1" locationid="1" /> </files>\[/code\]Part of the gallery functionality allows the user to delete the images. This is done via the following:Deletion 'Onlick' Event Code\[code\]<script type="text/javascript"> Galleria.ready(function() { this.$('thumblink').click(); $(".galleria-image").append( "<span class='btn-delete ui-icon ui-icon-trash'></span>"); $(".btn-delete").live("click", function(){ var img = $(this).closest(".galleria-image").find("img"); // send the AJAX request $.ajax({ url : 'delete.php', type : 'post', data : { image : img.attr('src') }, success : function(){ alert('Deleting image... '); img.parent().fadeOut('slow'); } }); return false; }); });</script>\[/code\]'delete.php'\[code\]<?phpif (!empty($_POST)) {$image = $_POST['image'];if (file_exists($image)) {unlink($image);} }?>\[/code\]The problem I have is that although I can delete the physical image I'm really not sure how to delete the relevant line from the XML file.I've done some research and to be honest this has confused me more than helped. I've read tutorials that explain how to remove the child node, whilst others have recommended \[code\]XPath\[/code\], so I'm not sure what to do.I just wondered whether someone may be able to take a look at this please and guide me as to which is the best method to use and how I may go about applying it to my file.Many thanks and regards
 
Back
Top