Hi all. I trying to upload an xml file to my script for parsing using the following form:
<form method="POST" name="xmlUpload" enctype="mulitpart/form-data" action="enterxml4.php">
<input type="hidden" name="test" value="Hidden Value">
<input type="hidden" name="upload_csvFile" value="">
<input type="file" size="30" name="upload">
<input type="submit" value="Upload" name="uploader">
</form>
The following instructions try to test if the file successfully uploaded
if($_POST["uploader"] == "Upload") {
echo "File uploader was used.";
$uploadedFile = stripslashes($_POST["upload"]);
$tempFile = $_FILES['upload']['tmp_name'];
echo "<br>File selected for upload was: $uploadedFile<br>";
echo "<br>\$tempFile = $tempFile<br>";
if(is_uploaded_file($_FILES['upload']['tmp_name'])) {
echo "<br>A file to upload was successfully passed.<br>";
} else {
echo "<br>A file to upload was not passed.<br>";
}
}
Those instructions always give the following output after I submit the form:
File uploader was used.
File selected for upload was: D:\Documents and Settings\jba87\My Documents\catTest.xml
$tempFile =
A file to upload was not passed.
I've tried declaring global $HTTP_POST_VARS and then using $HTTP_POST_FILES['upload']['tmp_name']
as well, and it yielded the same results. So it seems as if the file is not uploading, even though the string representing the filename on the client machine is coming through, as it can be accessed through $_POST["upload"]. Anyone have any idea why this is so?