php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55081 Warning: rename(/test2/conn.php,/test2/conn2.php) [function.rename]: No such fi
Submitted: 2011-06-30 02:02 UTC Modified: 2011-06-30 03:55 UTC
From: shuklaraje81 at yahoo dot com Assigned:
Status: Not a bug Package: Website problem
PHP Version: 5.2.17 OS: windows-xp
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: shuklaraje81 at yahoo dot com
New email:
PHP Version: OS:

 

 [2011-06-30 02:02 UTC] shuklaraje81 at yahoo dot com
Description:
------------
---
From manual page: http://www.php.net/function.rename%23Examples
---
<?php
if($_POST)
{
	rename("/test2/conn.php", "/test2/conn2.php");
}
?>
<form name="frm0" action="" method="post">
name<input  type="text" name="txtname" value="" />
<input type="submit" value="submit" name="submit" />
</form>


Expected result:
----------------
ihave a file in the test folder i wnt to copy this file in the test1 folder with different name

my script name is try that is lay in the test2 folder
all these three folder a lay in the C:\wamp\www\Rekha path


please sir give the answer what code error 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-06-30 03:16 UTC] fa@php.net
-Status: Open +Status: Bogus
 [2011-06-30 03:16 UTC] fa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

If you're on windows you shouldn't use

rename("/test2/conn.php", "/test2/conn2.php");

but probably

rename("c:\\wamp\\www\\Rekha\\conn.php", "c:\\wamp\\www\\Rekha\\conn2.php");
 [2011-06-30 03:47 UTC] tyrael@php.net
rename("/test2/conn.php", "/test2/conn2.php");
works on windows, why do you think that it should be used?

Tyrael
 [2011-06-30 03:55 UTC] tyrael@php.net
to answer the original question: your script doesn't work, because you are using 
absolute paths (starting with /), but as you mentioned, your directoris are under 
"C:\wamp\www\Rekha".
the suggested solution from Florian should work, but 
rename("./test2/conn.php", "./test2/conn2.php");
see the dots which means those paths are relative paths.

Tyrael
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC