PHP move file

To move a file from on directory to another directory, you will need to use rename($sourcefile,02-04-2013esfile). The example code below will move myfile.php from current directory to D:\test folder.

Example:
<html>
<head>
<title>move file</title>

<?php
$filename="myfile.php";
rename($filename,"D:\\test\\$filename");

?>
</head>

<body>
</body>
</html>

Posted by: Dara | post date: 02-04-2013 | Subject: PHP




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.