php - move_upload_file uploading old file? -


i'm working on "edit post" page allows users upload picture replace old picture (displayed @ bottom of post). here's code:

if (isset($_files['pic']['tmp_name']) && $_files['pic']['name']!=null) {              $target_file1 = $dir . $postid . "." . $imagefiletype1;             $target_png1 = $dir . $postid . ".png";             $target_jpg1 = $dir . $postid . ".jpg";             $target_jpeg1 = $dir . $postid . ".jpeg";              if (file_exists($target_png1)) {                 unlink($target_png1);             }             if (file_exists($target_jpg1)) {                 unlink($target_jpg1);             }             if (file_exists($target_jpeg1)) {                 unlink($target_jpeg1);             }             move_uploaded_file($_files["pic"]["tmp_name"], $target_file1);         } 

through doing testing, know works fine long new picture different extension original. if it's same extension deletes old 1 , move_uploaded_file reuploads old one.

i know because commented out "move_uploaded_files" , deleted old file.

any clues why reuploading old file instead of uploaded one?


Comments

Popular posts from this blog

how to do line continuation in perl debugger for entering raw multi-line text (EOT)? -

javascript - Create websocket without connecting -

sharepoint - Accessing files across a shared directory using a Windows service -