Here's the xml document
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<root>
<entry>
<title>The Final Countdown</title>
<artist>Europe</artist>
<album>The Final Countdown</album>
<genre>Rock</genre>
<year>1980</year>
<songDirectory>http://google.com</songDirectory>
<albumArtDirectory>./art/countdown.jpg</albumArtDirectory>
</entry>
</root>
And here's the php code, which tries to add another "entry" element:
move_uploaded_file($_FILES["albumArt"]["tmp_name"],
"art/" . $_FILES["albumArt"]["name"]);
$blog = new SimpleXMLElement("./blog/blog.xml", NULL, true);
$entry = $blog->addChild('entry');
$title = $entry->addChild('title', $_POST['title']);
$artist = $entry->addChild('artist', $_POST['artist']);
$album = $entry->addChild('album', $_POST['album']);
$genre = $entry->addChild('genre', $_POST['genre']);
$year = $entry->addChild('year', $_POST['year']);
$songDirectory = $entry->addChild('songDirectory', $_POST['song']);
$albumArtDirectory = $entry->addChild('albumArtDirectory', "art/" . $_FILES["albumArt"]["name"]);
File gets moved to correct directory, but the xml document does not change. No errors are thrown.
Thanks!
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<root>
<entry>
<title>The Final Countdown</title>
<artist>Europe</artist>
<album>The Final Countdown</album>
<genre>Rock</genre>
<year>1980</year>
<songDirectory>http://google.com</songDirectory>
<albumArtDirectory>./art/countdown.jpg</albumArtDirectory>
</entry>
</root>
And here's the php code, which tries to add another "entry" element:
move_uploaded_file($_FILES["albumArt"]["tmp_name"],
"art/" . $_FILES["albumArt"]["name"]);
$blog = new SimpleXMLElement("./blog/blog.xml", NULL, true);
$entry = $blog->addChild('entry');
$title = $entry->addChild('title', $_POST['title']);
$artist = $entry->addChild('artist', $_POST['artist']);
$album = $entry->addChild('album', $_POST['album']);
$genre = $entry->addChild('genre', $_POST['genre']);
$year = $entry->addChild('year', $_POST['year']);
$songDirectory = $entry->addChild('songDirectory', $_POST['song']);
$albumArtDirectory = $entry->addChild('albumArtDirectory', "art/" . $_FILES["albumArt"]["name"]);
File gets moved to correct directory, but the xml document does not change. No errors are thrown.
Thanks!