I am getting the following errors:
Notice: Undefined index: theimage in C:\wamp\www_upload\index.php on line 5
Notice: Undefined index: theimage in C:\wamp\www_upload\index.php on line 7
Here is the code:
<?php
$target_path = "images/";
$target_path = $target_path . basename( $_FILES['theimage']['name']);
if(move_uploaded_file($_FILES['theimage']['tmp_name'], $target_path)) {
echo "<p>The image ". basename( $_FILES['theimage']['name']). " has been uploaded</p>";
} else{
echo "<p>There was an error uploading the image, please try again!</p>";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="" content="">
</head>
<body>
<form enctype="multipart/form-data" action="index.php" method="POST">
<fieldset>
<input name="theimage" type="file" />
<input type="submit" value="Upload" />
</fieldset>
</form>
</body>
</html>
Any ideas on how to fix this please ?
print_r($_FILES)give you ?print_rof the$_FILESarray? Also, what are the values for these three php settings?file_uploads,upload_max_filesize,max_file_uploads