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
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短