php move file to another folder code example

Example 1: how to go to another folder in php

just add the source of another file
  for example:
you are in "localhost/library/admin/admin_login" and you have to go to student login
  <a href="localhost/library/student/student_login.php">For Student Login Click Here<a/>

Example 2: php move file

//Use the rename() function.
rename('first_location/image1.jpg', 'new_location/image1.jpg');

Example 3: PHP Move File from One Folder to Another

<?php  /* Store the path of source file */$filePath = 'images/test.jpeg';  /* Store the path of destination file */$destinationFilePath = 'copyImages/test.jpeg';  /* Move File from images to copyImages folder */if( !rename($filePath, $destinationFilePath) ) {      echo "File can't be moved!";  }  else {      echo "File has been moved!";  }   ?>

Tags:

Php Example