在PHP中使用重命名函数时出错

时间:2010-03-13 23:31:36

标签: php

我一直收到此错误,尽管该文件仍会移动到正确的目录中。有谁知道我为什么会收到这个错误?

Warning: rename(../Images/uploaded/1162504_56863010.jpg,../Images/uploaded/Portraits/1162504_56863010.jpg) [function.rename]: No error in D:\Data\Websites\wamp\www\StephsSite\PHP\addImage.php  on line 21

2 个答案:

答案 0 :(得分:5)

根据User Contributed Notesrename(),当目标文件已存在时,Windows系统上存在问题。

答案 1 :(得分:0)

一种可能性就是隐藏警告:

error_reporting(E_ALL & ~E_WARNING);
rename($old_name, $new_name);
error_reporting(E_ALL & ~E_NOTICE);