Hi all,
I am trying to create a form which allows the user to select the name of a file for upload and at the same time write the name of the file to a string so I can insert it in to my data table. When I run the test cade I get the error "Notice: Undefined index: bookcover"
This is what I have:
THE FORM
<form enctype="multipart/form-data" action="test2.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="10000000">
<table>
<tr>
<td>Please select a bookcover to UpLoad</td>
</tr>
<tr>
<td><input name="bookcover" id="bookcover" type="file" size ="60"/></td>
</tr>
<tr>
<td><input type="submit" value="Add bookcover!"><input type="reset"></td>
</tr>
</table>
</form>
THE SCRIPT
error_reporting(E_ALL);
ini_set("display_errors", 1);
$path = $_POST['bookcover'];
$file = basename($path);
$file = basename($path, ".php");
print $file