gpt4 book ai didi

php - copy 和 move_uploaded_file 的区别

转载 作者:可可西里 更新时间:2023-11-01 12:46:21 25 4
gpt4 key购买 nike

what is difference between copy() and move_uploaded_file()

我认为这两个函数执行相同的操作,那有什么区别呢?

copy ( $_FILES['file']['tmp_name'], 
"C:/Apache/htdocs/" . $_FILES['file']['name'] )


move_uploaded_file($_FILES['file']['tmp_name'],
"C:/Apache/htdocs/" . $_FILES['file']['name'])

最佳答案

This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.

This sort of check is especially important if there is any chance that anything done with uploaded files could reveal their contents to the user, or even to other users on the same system.

http://php.net/manual/en/function.move-uploaded-file.php

If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE.

关于php - copy 和 move_uploaded_file 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9139730/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com