| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
FileSystem |
JFile |
copy |
copy() |
Never | Work in Progress |
Copies a file. If the current user has permission and safe mode is turned off, then this function will use the PHP copy function. Otherwise, the function will use FTP (if enabled) to copy the file. The function returns true if the file was successfully copied. Otherwise, the function returns false and may raise a warning using the JError class.
boolean copy ( $src, $dest, $path )
| $src | string | is a string that contains the path to the source file. |
| $dest | string | is a string that contains the path to the destination file. |
| $path | string | is an optional string that contains a base path to prefix to the file names. |
Example: This example copies a file.
Example
if (JFile::copy( 'clock.jpg', 'clock_copy.jpg', 'images/stories/' )) { echo "<h3>File Successfully Copied</h3>"; } else { echo "<h3>Could not copy file</h3>"; }