Ihavethefollowingcodetouploadanimage:
var_dump($_FILES);$target_dir="uploads/";
$target_file = $target_dir . basename ( $_FILES ["fileToUpload"] ["name"] );
$uploadOk = 1;
$imageFileType = pathinfo ( $target_file, PATHINFO_EXTENSION );
if (isset ( $_POST ["submit"] )) {
$check = getimagesize ( $_FILES ["fileToUpload"] ["tmp_name"] );
if ($check !== false) {
echo "File is an image - " . $check ["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
but the following error appears when loading the image: array (1) {["fileToUpload"] = > array (5) {["name"] = > string (8) "css3.jpg" ["type"] = > string (10) "image / jpeg" ["tmp_name"] = > string (14) "/ tmp / php8UjGak" ["error"] = > int (0) ["size"] = > int (21455)}} File is an image - image / jpeg.