PHP - MySQL how to delete an image when a user submits a new image problem.

Posted by pc-wiki on Stack Overflow See other posts from Stack Overflow or by pc-wiki
Published on 2010-05-29T18:34:40Z Indexed on 2010/05/29 18:42 UTC
Read the original article Hit count: 163

Filed under:
|

I'm trying to delete the current image that is already set on the server when a user submits a new image to the server, but I don't know how to do add this to my current code can some one please help me?

Here is my PHP & MySQL code.

if(isset($_FILES["thumb"]["name"])) { 

    if (file_exists("/images/" . $_FILES["thumb"]["name"])) {
        $thumb != $_FILES["thumb"]["name"];
    } else if($_FILES["thumb"]["name"] == TRUE) {
      move_uploaded_file($_FILES["thumb"]["tmp_name"],
      "/images/" . mysqli_real_escape_string($mysqli, htmlentities(strip_tags(basename($_FILES["thumb"]["name"])))));
      $thumb = mysqli_real_escape_string($mysqli, htmlentities(strip_tags(basename($_FILES["thumb"]["name"]))));
    } 

        if($thumb == TRUE) {
            //create thumb code here...
        }

}

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql