Podczas wykonania operacji wyskakuje mi:
Notice: Undefined index: file in C:\xampp\htdocs\GALERIA\upload.php on line 4
Notice: Undefined index: file in C:\xampp\htdocs\GALERIA\upload.php on line 7
Notice: Undefined index: file in C:\xampp\htdocs\GALERIA\upload.php on line 8
Notice: Undefined index: file in C:\xampp\htdocs\GALERIA\upload.php on line 9
Notice: Undefined index: file in C:\xampp\htdocs\GALERIA\upload.php on line 10
Notice: Undefined index: file in C:\xampp\htdocs\GALERIA\upload.php on line 11
Próbowałam już chyba wszystkiego ale ciągle nie mogę pozbyć się błędów.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="upload.php" method="POST" enctype"
multipart/from-data">
<input type="file" name="file">
<button inptype type="submit" name="submit"> Dodaj zdjęcie </button>
</form>
</body>
</html>
<?php
if (isset($_POST['submit']))
{
$file = $_FILES['file'];
$fileName = $_FILES['file']['name'];
$fileTmpName = $_FILES['file']['tmp_name'];
$fileSize = $_FILES['file']['size'];
$fileError = $_FILES['file']['error'];
$fileType = $_FILES['file']['type'];
$fileExt = explode('.', $fileName);
$fileActualExt = strtolower(end($fileExt));
$allowed = array('jpg', 'jpeg', 'gif', 'png');
if (in_array($fileActualExt, $allowed))
{ if($fileError === 0)
{ if($fileSize < 1000000)
{ $fileNameNew = uniqid('', true).".".
$fileActualExt;
$fileDestination = 'foto/'. $fileNameNew;
move_uploaded_file($fileTmpName, $fileDestination);
header("Location: index.php?uploadsuccess");
}else {echo "Plik jest za duzy";}
}else{echo "Error";}
} else{echo "Plik ma złe rozszerzenie";}
}
?>