<form action = "index.php" method = "POST" enctype = "multipart/form-data">
<input type = "file" name = "image_name" /><input type = "submit" value = "Upload" name = "upload"/>
</form>
<?php
include("connect.php");
if(isset($_POST['upload'])){
$file = file_get_contents($_FILES['image_name']['tmp_name']);
$name = $_FILES['image_name']['name'];
$image_size = getimagesize($_FILES['image_name']['tmp_name']);
if($image_size == false){
echo "Thats not an image.";
}
}
?>
There is an error that appears. How can I avoid the error notice?
Here is the error message:
Notice: getimagesize() [function.getimagesize]: Read error! in C:\\xampp\\htdocs\\picture\\index.php on line 16
Use @getimagesize
to suppress the notice. An error is the expected behavior if the file can't be read as an image.
See PHP: Error Control Operators for more information about the @
operator.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.