file rename while uploading

后端 未结 5 1910
孤独总比滥情好
孤独总比滥情好 2021-01-16 20:34

I have a problem here im trying to upload a file

first time it is moving the filename from temp it its respective directory,

but again i try ot upload the a

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-16 21:18

    What about...

    $place_file = "$path/$upload_to/$file_name";     
    
    if (file_exists($place_file)) {
       $place_file = date("mdYHis")."_".$file_name;
    }
    
    if (!move_uploaded_file($tmp, $place_file)) {
       echo "Could not move file";
       exit;
    }
    

提交回复
热议问题