Home > PHP > Function > Filesystem > copy()

copy()

copy - Copies file

Syntax

bool copy (string $source, string $dest, resource $context)

Arguments

  • source - Path to the source file.
  • dest - The destination path. If dest is a URL, the copy operation may fail if the wrapper does not support overwriting of existing files. Warning If the destination file already exists, it will be overwritten.
  • context - A valid context resource created with stream_context_create().

Description

Makes a copy of the file source to dest.

Version

PHP 4, 5

Return value

Returns TRUE on success or FALSE on failure.