this is in my html/php file... I just set it up to submit to itself because that was easy for me.
<?php
if (isset($_FILES['file'])) {
$file = $_FILES['file']['tmp_name'];
$catalog = simplexml_load_file($file);
echo '<table style="border-spacing: 10px;">';
echo '<tr><th>Title</th><th>Author</th></tr>';
foreach ($catalog->book as $b) {
echo '<tr><td>'.$b->title.'</td><td>'.$b->author.'</td></tr>';
}
echo '</table>';
}
else {
?>
<!-- change the filename below -->
<form action="filename.html" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>
<?php } ?>
and here is the xml that I used in a file to upload with the form...
<?xml version="1.0"?>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
<book id="bk102">
<author>Ralls, Kim</author>
<title>Midnight Rain</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-12-16</publish_date>
<description>A former architect battles corporate zombies,
an evil sorceress, and her own childhood to become queen
of the world.</description>
</book>
<book id="bk103">
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society.</description>
</book>
</catalog>
it just either displays the upload form or the table of books
Title Author
XML Developer's Guide Gambardella, Matthew
Midnight Rain Ralls, Kim
Maeve Ascendant Corets, Eva
also... as noted at the link below... if you don't move or rename the temp file, it will be deleted when the php script ends.
php:: how long to tmp files stay?