i have the following php. the script gives me an error telling me that i have not selected a file to upload even when i have done so. if i try to access the $_FILES['minuteFile']['tmp_name'] i don't get anything but the $_FILES['minuteFile']['name'] would be having some. what could be the cause of the $_FILES['minuteFile']['tmp_name'] not being accessible.
<?php
require_once 'includes/core.php';
if ( isset( $_POST['submitted'] ) ) { // form submitted
$errors = array(); // initialize $errors to an empty array
$minute = new Minute(); // create a new instance of the Minute class
// validation for the minute file
if ( is_uploaded_file( $_FILES['minuteFile']['tmp_name'] ) ) { // a file has been selected for uploading
if ( ( $_FILES['minuteFile']['type'] == 'application/pdf' ) ) { // file is a .pdf file
$name = $_FILES['minuteFIle']['name'];
if ( file_exists( ARCHIVE . DS . $name ) ) { // file already exists in archives folder
$errors[] = 'Upload a different file. File already exists on server.';
unlink( $_FILES['minuteFile']['tmp_name'] ); // delete file from temporary location
} elseif ( !file_exists( ARCHIVE . DS . $name ) ) { // file doesn't exist in archives folder
// move the selected file from the temporary folder to the archives folder
$moveResult = move_uploaded_file( $_FILES['minuteFile']['tmp_name'], ARCHIVE . DS . $name );
if ( $moveResult ) { // move operation was successful
$minute = $name;
} elseif ( !$moveResult ) { // move operation not successful
unlink( $_FILES['minuteFile']['type'] ); // delete file from temporary location
}
}
}
} else { // not file selected for upload
$errors[] = 'Please select a file to upload.';
}
}
?>
<!DOCTYPE html>
<head>
<title>Harare City Council: Add New Minutes</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
</head>
<body>
<div align="center">
<div id="content">
<h2>New Minutes Details</h2>
<?php
if ( isset( $errors ) && is_array( $errors ) ) {
echo '<ul>';
foreach( $errors as $error ) {
echo '<li class="error">' . $error . '</li>';
}
echo '</ul>';
}
?>
<form action="" method="post" enctype="multipart/form-data">
<table cellpadding="3" cellspacing="3">
<tr>
<td class="datalabel">Title:</td>
<td><input type="text" name="txtMinutesTitle" size="30" maxlength="60" value="<?php if ( isset( $_POST['txtMinutesTitle'] ) ) echo $_POST['txtMinutesTitle']; ?>" /></td>
</tr>
<tr>
<td class="datalabel">File(.pdf):</td>
<td><input type="file" name="minuteFile" /></td>
</tr>
<tr>
<td colspan="2" align="right">
<input type="submit" name="submitted" value="Save" />
</td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>