What are some alternative methods to copy a file into a directory when restricted by PHP SAFE MODE?

When restricted by PHP SAFE MODE, the traditional methods of copying a file into a directory using functions like `copy()` or `move_uploaded_file()` may not work. In this case, an alternative method is to use the `file_get_contents()` and `file_put_contents()` functions to read the file contents and write them to the desired directory.

$file = 'file.txt';
$directory = 'path/to/directory/';

$content = file_get_contents($file);
file_put_contents($directory . basename($file), $content);