PHP中的move_uploaded_file()函数
move_uploaded_file()函数将上传的文件移动到新位置。如果目标文件已经存在,它将被覆盖。
语法
move_uploaded_file(file_path, moved_path)
参数
file_path-要移动的文件。
moving_path-文件将被移动到的位置。
返回
move_uploaded_file()函数在成功时返回true,在失败时返回false。
示例
<?php
if (move_uploaded_file($_FILES['userfile']['tmp_name'], "/documents/new/")) {
print "上传成功!";
} else {
print "上传失败!";
}
?>输出结果
上传失败!PHP Notice: Undefined index: userfile in /home/cg/root/8944881/main.php on line 2
热门推荐
1 训练狗狗基础
2 怎么训练狗狗笑
3 怎么训练狗狗卧下
4 上海狗狗训练基地
5 训练狗狗排便
6 狗狗基础训练
8 如何训练狗狗装死
9 狗狗站姿训练
10 狗狗训练用品
11 训练狗狗吧
12 狗狗要怎么训练
13 怎么训练狗狗玩球
14 训练狗狗唤回
15 狗狗训练躺下
16 狗狗训练指令
17 狗狗的训练技巧
18 狗狗不好训练