Reputation: 59
I need to develop a PHP script that will be able to select files from the server to copy them to the same server but to another directory.
I need to select the file like if I was selecting a file from my local computer.
This is possible? What steps should I take to begin with this script? There are any tutorials out there that exemplifies this scenario?
Best Regards,
Sorry for my English.
Upvotes: 1
Views: 1063
Reputation: 5148
copy($sourceFile, $destinationFile);
If $destinationFile exists, it will be overwritten.
UPDATE:
To read the filelist in a specific directory you can use this function:
function dirlist($directory){
if (is_dir($directory)){
if ($handle = opendir($directory)){
while (($file = readdir($handle)) !== false){
$files[] = $file;
}
closedir($handle);
}
}
return $files;
}
Upvotes: 2