I'm getting the error
Notice: Undefined index: file_upload in C:\MAMP\htdocs\basic_files\upload.php on line 3
When I load the page to upload the file in the form.
I know a lot of other people cite a problem with the enctype or php.ini settings as reasons for this error but I'm quite sure mine are ok. I've cleared the browser (chrome) cache and restarted the MAMP server a couple of times just to make sure but I'm still getting the error.
My php.ini settings are:
file_uploads = On
upload_max_filesize = 128M
max_file_uploads = 20
memory_limit = 128M
max_execution_time = 30
post_max_size = 128M
My PHP is:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
echo "<pre>Max upload size: ".ini_get('upload_max_filesize')."\nMax post
size: ".ini_get('post_max_size')."</pre>";
if (isset($_POST['submit'])) {
print_r($_FILES['file_upload']);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="upload.php" enctype="multipart/form-data"
method="post">
<input type="file" name="file_upload"><br>
<input type="submit" name="submit">
</form>
</body>
</html>
When I click the submit button the page does nothing for a few seconds and then goes to a blank page still called upload.php.