note 128046 added to features.file-upload.errors
| From: | Narek at main dot php dot net | Date: | Fri, 23 Dec 2022 12:54:45 +0000 |
| Subject: | note 128046 added to features.file-upload.errors | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220002@lists.php.net to get a copy of this message | ||
This is my file.php
<!DOCTYPE html>
<html>
<body>
<form action="upload.php" method="post"
enctype="multipart/form-data">
<h1>Select a file to upload</h1>
<input type="file" name="upfile" id="upfile">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
And this is the upload.php
<?php
$dir = "t1files/";
$target_file = $dir . basename($_FILES["upfile"]["name"]);
$upOk = 1;
$imgtype = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["upfile"]["tmp_name"]);
if($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
$upOk = 1;
} else {
echo "File is not an image.";
$upOk = 0;
}
}
?>
The t1files/ is directory folder where the image files needs to be stored after pressing the upload.
But when I choose a file and click the submit button it throws me to my upload.php file where I can
see the code in the web and after reloading the page it goes down and brings an Error 412
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.175 (proxied: 81.89.213.20)
----
Manual Page -- https://php.net/manual/en/features.file-upload.errors.php
Edit -- https://main.php.net/note/edit/128046
Del: integrated -- https://main.php.net/note/delete/128046/integrated
Del: useless -- https://main.php.net/note/delete/128046/useless
Del: bad code -- https://main.php.net/note/delete/128046/bad+code
Del: spam -- https://main.php.net/note/delete/128046/spam
Del: non-english -- https://main.php.net/note/delete/128046/non-english
Del: in docs -- https://main.php.net/note/delete/128046/in+docs
Del: other reasons-- https://main.php.net/note/delete/128046
Reject -- https://main.php.net/note/reject/128046
Search -- https://main.php.net/manage/user-notes.php