24.6.1. ProblemYou want to copy or move a file. 24.6.2. SolutionUse copy( ) to copy a file, as shown in Example 24-17. Copying a file
Use rename( ) to move a file, as shown in Example 24-18. Moving a file
24.6.3. DiscussionOn Unix, rename( ) can't move files across filesystems under PHP versions before 4.3.3. To do so, copy the file to the new location and then delete the old file. This is shown in Example 24-19. Moving a file across filesystems
If you have multiple files to copy or move, call copy( ) or rename( ) in a loop. You can operate only on one file each time you call these functions. 24.6.4. See AlsoDocumentation on copy( ) at http://www.php.net/copy and rename( ) at http://www.php.net/rename. |