file rename while uploading

后端 未结 5 1951
孤独总比滥情好
孤独总比滥情好 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条回答
  •  猫巷女王i
    2021-01-16 21:34

    how about something like this?

     "/temp/bar.2012-12-12-12-12-12.xyz"
      $_destination = dirname($destination) . '/'
          . substr($file, 0, $dot + 1)
          . date('Y-m-d-H-i-s', filectime($destination))
          . substr($file, $dot);
    
      rename($destination, $_destination);
    }
    
    move_uploaded_file($tmp, $destination);
    

提交回复
热议问题