Hi All,
I have a small issue with a script I am working on. I am trying to learn php but I have a php 4 'manual' with php 5 loaded! I have found errors (in the book) which I have sorted but this one has got me stumped!
I have used a standard form to upload the file then pass that into the filehandler.php but everytime I hit the upload I get a Error 500 - Internal server error.
OS: Win XP
Web server : Abyss V2.0 (free version)
HTML:
<html>
<body>
<!-- Form needs rto be multipart for the file upload -->
<form action=filehandler.php" method="$_POST" enctype="multipart/form-data">
Enter the filename (including the path) or click browse:<p>
<!-- Set max size to 100K -->
<input type=hidden name=MAX_FILE_SIZE value=100000>
<input type=file name=resume><p>
<input type=submit value=Upload>
</form>
</body>
</html>
PHP
<?php
// Begin HTML Page
print "<html><body>";
// Get the data out of the "resume" form element
$filedata = $_FILE['resume'];
$tempfile = $filedata['tmp_name'];
// Check to see if the file is indeed an upload
if (is_uploaded_file($tempfile)
{
// Create destination path/filename
$destfile="/".$filedata['name'];
// Attempt file move and report success/failure
if (move_uploaded_file($tempfile, $destfile))
{
print "File moved to: $destfile";
} else {
print "File cannot be moved to : $destfile";
} esle {
// File not specified in "resume" element was not an upload or nothing specified
print "No uploaded file!";
}
}
// Close open HTML elements
print "</html></body>";
?>
Can anyone help me ?