PHP.nl

copy

copy

Copies file

bool **copy** string $from string $to  $context

Makes a copy of the file to . from``to

If you wish to move a file, use the function. rename

fromPath to the source file.

to The destination path. If is a URL, the copy operation may fail if the wrapper does not support overwriting of existing files. to

Waarschuwing: > If the destination file already exists, it will be overwritten.

context A valid context resource created with . stream_context_create

return.success

Voorbeeld: example

<?php
$file = 'example.txt';
$newfile = 'example.txt.bak';

if (!copy($file, $newfile)) {
    echo "failed to copy $file...\n";
}
?>

move_uploaded_file``renamehandling file uploads