file upload - PHP image validation not working -


i working on cms site. i've created created "new-post.php" page & added conditions image type & size validation. works perfectly. i've same page updating post. condition not working on page. shows "invalid image" alert upload image valid extension. what's wrong code?

any appreciated!

if(!$stmt)             {                 echo "<div class='alert alert-danger' style='margin-top: 20px;'><span class='glyphicon glyphicon-exclamation-sign'></span> <strong>post has not been updated.</strong></div><a href='dashboard?new' class='btn btn-danger btn-sm' style'margin-top: 50px;'>take me there again.i'll try again.</a>";             }             else             {                 if($image_type=="pimage/jpeg" or $image_type=="pimage/jpg" or $image_type=="pimage/png" or $image_type=="pimage/bmp" or $image_type=="pimage/gif")                 {                     $stmt->execute();                     move_uploaded_file($image_tmp, "uploads/$image");                     echo "<div class='alert alert-success' style='margin-top: 20px;'><span class='glyphicon glyphicon-ok-sign'></span> <strong>post has been updated successfully.</strong></div>                         <a href='dashboard?view' class='btn btn-danger btn-lg' style'margin-top: 50px;'>show me</a>";                 }                 else                 {                     echo "<script>alert('invalid image');</script>";                 }              } 

typo error. should "image" not "pimage"

if($image_type=="image/jpeg" or $image_type=="image/jpg" or $image_type=="image/png" or $image_type=="image/bmp" or $image_type=="image/gif") 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -