Accidentally do file moving time summed up a knowledge point: At the beginning, thought that with the upload file can use move_uploaded_file this function to move a file, after trying to find no, online search A, found that you can use rename this function to achieve file or folder movement, very strange, the manual is written in duplicate files or folders, did not expect to be used to move files
About function return values:
BOOL Rename (string $oldname, String $newname [, Resource $context])
Attempt to rename the Oldname to NewName and return true if the operation succeeds, and the failure returns false.
1. For files, rename can be moved between different disk characters.
2. For empty folders, rename can also move between different disk characters. However, the parent directory of the destination folder must exist.
3. For Non-empty folders, you can only move under the same letter.
Usage is as follows:
Rename ("/tmp/www.txt", "/home/my_file.txt");
The first parameter puts the original address, the second parameter puts the target address;
There is a way to use Copy+unlink online, but I heard that the speed of moving is not how, so also do not say, with rename on the line, simple, convenient, fast
may be accustomed to using Copy,unlink to achieve file movement, for large files, may take a long time, but the test found that performance is not.
Supplementary: Problems in Chinese documents and folders