I would like to read excel files. I thought the easiest way to do so would be to save the excel file as an XML speardsheet and load the data using PHP and DOMDocument. I first tried using the following code to read the data of an uploaded XML spreadsheet: if ( $_FILES['pricefile']['tmp_name'] ){ $dom = new DomDocument('1.0'); $dom->load($_FILES['pricefile']['tmp_name']); echo $dom->saveXML(); } Obviously, I have a form which submits to this page and which contains the HTML form element <input name="pricefile" type="file" /> The result should be that the page display the XML content of the uploaded file. However, in practice, all I get is the first line in the XML document: <?xml version="1.0"?> and nothing after that. Can anyone think of a reason why this is happening?
$dom->load(file_get_contents($_FILES['pricefile']['tmp_name'])); by any chance? Seems like you'd only be loading the name '124afa3r.tmp' instead of the xml data.
Ok, I got it. The problem was, to whom it may concern, that I was trying to load the data from it's temporary upload location. In order to have things work properly, the file must first be uploaded and copied to a chosen location. You can then load the file content and move on.